Advanced Toolbar/Menu Management

How can I add/remove buttons to toolbars during runtime? How can I catch these buttons' events?

Same goes for the Menus.

I mean, of course, that originally those resources were created with Resource wizard, not created dynamically.
LVL 1
LeschaAsked:
Who is Participating?
 
RONSLOWConnect With a Mentor Commented:
GetToolBarCtrl to get a pointer to the underlying tollbar ctrl.

Then call AddButtons to add buttons to the toolbar.

You'll probably need to call RecalcLayout when you're finished.


0
 
ch52jbCommented:
When you say the resources were created with the resource wizard, do you mean that the buttons you want to add/remove were created by the resource wizard?  If so, then all you need to do is hide/show the buttons as required either by tying a CButton to the buttons, or by using GetDlgItem(ID) and calling the showwindow method.
0
 
proskigCommented:
You might want to check out this article http://www.codeguru.com/toolbar/customizable_tb.shtml and some other article on 'toolbar' topic
0
 
LeschaAuthor Commented:
Thanks, I'll check it out.

"ch52jb" -
No, I mean the Toolbar/Menu was originally created in the Wizard, and I want to add more buttons in the runtime.

Example:

I have a COLORS toolbar with only one button on it originally: "Colors Choice". During the runtime, I want to add one by one the buttons representing the colors the user have already chosen during the session.

I need to:

1) Create bitmaps during the runtime.
2) Create buttons and associate bitmaps with buttons and buttons with toolbars.
3) Somehow catch and respond to messages created by the new buttons being clicked.
0
All Courses

From novice to tech pro — start learning today.