Solved

Adding Accelerator Keys to toolbars

Posted on 1998-12-08
2
307 Views
Last Modified: 2013-11-20
How do I get Accelerator Keys such as Alt+F to bring up a drop-down button in a tool bar?  I have used the MapAccelerator fucntion in the CToolBarCtrl but that seems to do nothing, do I have to route a message from the main window to the toolbar?
0
Comment
Question by:traott
2 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 100 total points
ID: 1325921
An accelerator will go to the menu and if the menu finds an appropriate action, it translates the keystroke into a command message and posts that to the window which owns the menu. So you will need to have a response handler for the command in your main window. From that handler, you need to decide appropriate what to do. Alternatively, you can even override OnCmdMsg() in your frame window to route to the toolbar's if the toolbar has such a handler in it.
0
 

Author Comment

by:traott
ID: 1325922
OK, I got that to work, but now when I try to bring up the menu for the drop down using TrackPopupMenu(...) it returns a bad status and the error I get says that the Popup menu is already active. It does not do this if I click on the button, and it is using the same code.  Do I have to deactivate it?  If so, how do I it?
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

862 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

24 Experts available now in Live!

Get 1:1 Help Now