Solved

Accelerator keys in CDialog

Posted on 1997-03-18
2
505 Views
Last Modified: 2013-11-20
How can I add accelerator keys to a CDialog window?

I want to be able to act upon a certain alt-key sequence (not associated with a control such as a button).

I have created a new accelerator table with my values, but no WM_COMMAND is sent when I enter the sequence in the window (just a bell).
0
Comment
Question by:tdietz
2 Comments
 
LVL 1

Accepted Solution

by:
rhgaracci earned 200 total points
ID: 1300085
In the resource view, select the accelerator resource.  Press Ctrl-W to bring up class wizard.  Class wizard will display a dialog that allows to to associate the accelerator with your CDialog derived dialog class.  Select your dialog class.

Then, in class wizard, the IDs of your accelerators will be displayed in your dialog class.  Associate a COMMAND message with the ID to create an On...() member function.  Then put your response functionality into the On...().
0
 

Author Comment

by:tdietz
ID: 1300086
Originally you answer seemed to work.  However, it does not, or at least the steps I followed do not.

I have a CDialog window created.  I want to do something when the user press ALT-UP or ALT-DOWN.  I added the accelerators in the Accelerator Table, then hit CTRL-W for Class Wizard.  Everything is fine.  Two new commands are added to the window I want (which is actually a CWnd as a child of a CDialog).

I added a handler for both the functions.  When I press ALT-Up or ALT-DOWN I still get a bell.

I have tried adding new "accelerator tables" through class wizard for both the CWnd and the main CDialog.  I have even tried using a simple ALT-A sequence instead of ALT-DOWN, with no luck.

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

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

895 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

17 Experts available now in Live!

Get 1:1 Help Now