Print Page | Close Window

CXTPToolBar, CImageList problem

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=1804
Printed Date: 08 July 2024 at 1:33am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPToolBar, CImageList problem
Posted By: hpesata
Subject: CXTPToolBar, CImageList problem
Date Posted: 17 February 2005 at 9:52am
Hi!

XTreme Toolkit Pro V 9.51:

I am trying to create a toolbar with bitmaps loaded from files instead of resource-bitmaps.
I am creating the CXTPToolBar with
pStandardBar = GetCommandBars()->Add(_T("Standard"), xtpBarTop).

I am saving the bitmap-objects into a CImageList-object and use the following code to add it to the toolbar:

XTPImageManager()->SetIcons(myimagelist, CmdIds, nImgs, CSize(16, 16));
RecalcLayout(FALSE);
GetCommandBars()->RedrawCommandBars();

The images appear in my menu at the correct position, but they dont appear in the toolbar,
it stays empty.

What do I have to do to make the images visible in the toolbar too ?

Many thanx in advance!

best regards,
Hans Pesata




Replies:
Posted By: Oleg
Date Posted: 17 February 2005 at 2:09pm
How do you set controls for Toolbar? Are you sure it has Ids from CmdIds collection?

-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: hpesata
Date Posted: 18 February 2005 at 2:20am
Hi!

// XTPImageManager()->SetIcons(myimagelist, CmdIds, nImgs, CSize(16, 16));

CmdIds is a UINT* with the size of nImgs. this seems to be working, because the images are displayed correctly within my menu.

I am not using LoadToolbar(), because I dont have a resource.

do I have to do something that is done within LoadToolbar() ?

what do you mean by "how do you set controls" ?

all I currently do is the code I posted.

best regards,
Hans



Posted By: Oleg
Date Posted: 18 February 2005 at 3:44am

When you call

pStandardBar = GetCommandBars()->Add(_T("Standard"), xtpBarTop).
you create toolbar without buttons.

Now you must add buttons you need:

pStandardBar->GetControls()->Add(xtpControlButton, CmdIds[0]);

pStandardBar->GetControls()->Add(xtpControlButton, CmdIds[1]);

 

or

pStandardBar->SetButtons(CmdIds, nImgs);



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: hpesata
Date Posted: 18 February 2005 at 1:26pm
Hi Oleg!

thanx for your support!

I added your code and the toolabr buttons are displayed now too.
I am using the following code:

XTPImageManager()->SetMaskColor(RGB(0, 255, 0));
XTPImageManager()->SetIcons(myimagelist, CmdIds, nCmdIds, size, CSize(16,16));
XTPImageManager()->RefreshAll();

the problem I have now is, that the mask-color doesnt work. I am using green RGB(0, 255, 0) within my bitmaps to mark the transparent pixels and also use the appropriate SetmaskColor() call, but the green pixels within the bitmaps stays visible instead of being replaced by the underlying colors.

any hints on how to solve that ?

best regards,
Hans




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net