Solved

Accelerator keys in CDialog

Posted on 1997-03-18
2
511 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

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…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

810 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