Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: MFC
Why Accelerator keys are not visible in menu options of the application in sdi mfc vc++ 2010
Posted 21-Jan-13 22:07pm
Edited 21-Jan-13 22:41pm
v2
Comments
Andy411 at 22-Jan-13 4:21am
   
What do you mean with "menu options"? AFAIK You have to add the accelerator keys in the menu text by yourself. e.g.: "Save\tCtrl-S"
Jochen Arndt at 22-Jan-13 4:32am
   
Andy is right for shortcut keys. If you refer to the underlined accelerator keys, see this MSDN blog post: http://blogs.msdn.com/b/oldnewthing/archive/2005/05/03/414317.aspx
Andy411 at 22-Jan-13 4:55am
   
Good hint, Jochen!

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Defining accelerator keys and menu item accelerators are two separate tasks.
 
Accelerator keys are implemented in the resource file as:
 
IDR_ACCELERATORS ACCELERATORS 
BEGIN
    "A",            ID_EDIT_SELECT_ALL,     VIRTKEY, CONTROL, NOINVERT
    "C",            ID_EDIT_COPY,           VIRTKEY, CONTROL, NOINVERT
    "V",            ID_EDIT_PASTE,          VIRTKEY, CONTROL, NOINVERT
    "X",            ID_EDIT_CUT,            VIRTKEY, CONTROL, NOINVERT
    "Z",            ID_EDIT_UNDO,           VIRTKEY, CONTROL, NOINVERT
    VK_F6,          ID_NEXT_PANE,           VIRTKEY 
    VK_F6,          ID_PREV_PANE,           VIRTKEY, SHIFT
END
 
Menu items are implemented in the resource file as:
 
IDR_MAINMENU MENU DISCARDABLE
BEGIN
    POPUP "&File"
    BEGIN
        MENUITEM "E&xit",                       ID_APP_EXIT
    END
END
 
Note the use of the ampersand ("&") in the menu definitions.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 800
1 OriginalGriff 503
2 Abhinav S 253
3 thatraja 245
4 Emre Ataseven 200
0 Sergey Alexandrovich Kryukov 8,282
1 OriginalGriff 4,750
2 Peter Leow 3,784
3 Maciej Los 3,515
4 Er. Puneet Goel 3,107


Advertise | Privacy | Mobile
Web01 | 2.8.140415.2 | Last Updated 22 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid