Solved

Advanced Toolbar/Menu Management

Posted on 2000-04-14
4
188 Views
Last Modified: 2013-11-20
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.
0
Comment
Question by:Lescha
4 Comments
 

Expert Comment

by:ch52jb
ID: 2716409
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
 
LVL 5

Expert Comment

by:proskig
ID: 2716463
You might want to check out this article http://www.codeguru.com/toolbar/customizable_tb.shtml and some other article on 'toolbar' topic
0
 
LVL 1

Author Comment

by:Lescha
ID: 2717225
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
 
LVL 10

Accepted Solution

by:
RONSLOW earned 20 total points
ID: 2721321
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

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
MFC Dialog 9 47
if loop in java 3 114
withoutTen challenge 14 88
mapBully challenge 6 93
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now