Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Dynamically building a tool bar
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Dynamically building a tool bar

 Post Reply Post Reply
Author
Message
Defta View Drop Down
Newbie
Newbie


Joined: 21 December 2009
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote Defta Quote  Post ReplyReply Direct Link To This Post Topic: Dynamically building a tool bar
    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
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.063 seconds.