![]() |
Dynamically building a tool bar |
Post Reply ![]() |
Author | |
Defta ![]() Newbie ![]() Joined: 21 December 2009 Status: Offline Points: 1 |
![]() ![]() ![]() ![]() ![]() Posted: 21 December 2009 at 12:26pm |
I'm trying to switch from my existing straight MFC code for building dynamic tool bars to Code Jock. The task is to build the tool bar from a CImageList and a set of command ids. It's fairly straightforward in MFC, just bind the image list to the underlying CToolBarCtrl and then call SetButtons() with the command ids.
The analog in CodeJock seems to be to get the images into a CTXPImageManager instance and call SetImageManager(), then call SetButtons(). I've tried the following, assuming 8 commands to be in the tool bar. The CImageList is already built (pMyImageList) and anMyCommands holds the vector of command ids.
CXTPImageManager * pImageManager = new CXTPImageManager;
pImageManager->SetImageList( pMyImageList, 9001 );
pToolBar->SetImageManager( pImageManager );
pToolBar->SetButtons( anMyCommands, 8 );
There are two problems I've encountered.
1) Unlike MFC, where commands can have any ids, CJ seems to require my tool bar commands to be contiguously-numbered. In the example above, if they are 9001-9008, it works. If they are discontinguous, it doesn't. This is more of an annoyance than a problem, but I'd like to know if there is any way around this?
2) The images associated dropdown menus in the frame window do not match the images I assign in this process. I get blanks next to the menu item unlike what happens when LoadToolBar() is used. How can I get them to synch to the toolbar images specified by this approach?
ageManager
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi,
Instead pImageManager->SetImageList use pImageManager->SetIcons(...) and manually sepecify what icons you have in imagelist in parameters.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |