Click here to Skip to main content
12,700,966 members (29,224 online)
Rate this:
 
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 23:07pm
Updated 21-Jan-13 23:41pm
v2
Comments
Andy411 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 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 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
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.170118.1 | Last Updated 22 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100