Icons in CXTPToolBar
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=11164
Printed Date: 01 March 2025 at 12:06am Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com
Topic: Icons in CXTPToolBar
Posted By: GoBeavs
Subject: Icons in CXTPToolBar
Date Posted: 23 June 2008 at 12:31pm
Hi,
I'm trying to reuse some icons in a toolbar with the following code.
{ // make the array for the icons UINT icons[] = {0, 0, 0, 0, 0, ID_VALUESET_COMMITCHANGES};
// now set the color icon int index = 0; // if we have a valuset, get the correct color icons[index] = ID_VALUESET_COLOR; // set the icons for the toobar VERIFY(m_MainToolBar->GetImageManager()->SetIcons(IDB_VALUESET, icons, _countof(icons), CSize(32, 32)) ); m_MainToolBar->Invalidate(); }
What I'm seeing is that I am always getting the first 2 icons out of IDB_VALUSET which is a .png file. The behavior I desire is to pick icons within that file and set them on particular buttons. m_MainToolBar is a CXTPToolBar.
Is it the case that the specification of icons[] is somehow wrong, or is this just not possible with a CXTPToolBar?
Thanks,
Darin
|
Replies:
Posted By: Oleg
Date Posted: 23 June 2008 at 1:36pm
Hi,
Need to see your toolbar resource and your toolbar bitmap to understand what you need.
Attach sample.
------------- Oleg, Support Team CODEJOCK SOFTWARE SOLUTIONS
|
Posted By: GoBeavs
Date Posted: 23 June 2008 at 1:44pm
Thanks.
We have found 2 ways to resolve this problem and would like to know which is the preferred method. We found empirically that:
1. Since there are 10 images in my .png file, if I change the icon array to have a place for each icon, the code works.
UINT icons[] = {0, 0, 0, 0, 0, ID_VALUESET_COMMITCHANGES, 0, 0, 0, 0};
2. Changing the array to indicate unused icons with -1 makes the icon mapping work
UINT icons[] = {-1, -1, -1, -1, -1, ID_VALUESET_COMMITCHANGES};
Which is preferred? I tend to like number 2 because it doesn't require me to know how many icons are in the png file, just account for which ones I'm using.
Thanks
|
Posted By: Oleg
Date Posted: 23 June 2008 at 2:50pm
Hi,
I'm not even sure that second method really work. if you don't know how many icons in file, how ImageManager have to determine it ?
Use first method.
------------- Oleg, Support Team CODEJOCK SOFTWARE SOLUTIONS
|
|