Solved

Accelerator keys in CDialog

Posted on 1997-03-18
2
499 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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
iSeries FTP Exit Program 8 113
NotAlone Challenge 20 70
Line meaning 9 75
Detect file exist or not 3 74
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

762 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

11 Experts available now in Live!

Get 1:1 Help Now