Print Page | Close Window

Dynamically building a tool bar

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=15904
Printed Date: 19 October 2025 at 3:27am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Dynamically building a tool bar
Posted By: Defta
Subject: Dynamically building a tool bar
Date 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



Replies:
Posted By: Oleg
Date Posted: 23 December 2009 at 7:33am
Hi,
 
Instead pImageManager->SetImageList use pImageManager->SetIcons(...) and manually sepecify what icons you have in imagelist in parameters.


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



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