Skip to content

Commit de3d3e3

Browse files
authored
Merge pull request MicrosoftDocs#1707 from msebolt/resource-file-consolidation-pr22
resource file consolidation pr22
2 parents 26d31b1 + f45f864 commit de3d3e3

5 files changed

Lines changed: 44 additions & 66 deletions

‎.openpublishing.redirection.json‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7545,6 +7545,16 @@
75457545
"redirect_url": "/cpp/windows/selecting-multiple-menus-or-menu-commands",
75467546
"redirect_document_id": false
75477547
},
7548+
{
7549+
"source_path": "docs/windows/associating-menu-commands-with-status-bar-text-in-mfc-applications.md",
7550+
"redirect_url": "/cpp/windows/associating-a-menu-command-with-an-accelerator-key",
7551+
"redirect_document_id": false
7552+
},
7553+
{
7554+
"source_path": "docs/windows/assigning-access-keys-to-menu-commands.md",
7555+
"redirect_url": "/cpp/windows/associating-a-menu-command-with-an-accelerator-key",
7556+
"redirect_document_id": false
7557+
},
75487558
{
75497559
"source_path": "docs/windows/activationfactory-activationfactory-constructor.md",
75507560
"redirect_url": "/cpp/windows/activationfactory-class#activationfactory",

‎docs/windows/TOC.md‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,7 @@
132132
##### [Creating a Submenu](creating-a-submenu.md)
133133
##### [Creating Pop-up Menus](creating-pop-up-menus.md)
134134
##### [Editing Multiple Menus or Menu Commands](selecting-multiple-menus-or-menu-commands.md)
135-
##### [Associating a Menu Command with an Accelerator Key](associating-a-menu-command-with-an-accelerator-key.md)
136-
##### [Associating Menu Commands with Status Bar Text in MFC Applications](associating-menu-commands-with-status-bar-text-in-mfc-applications.md)
137-
##### [Assigning Access Keys to Menu Commands](assigning-access-keys-to-menu-commands.md)
135+
##### [Associating Menu Commands](associating-a-menu-command-with-an-accelerator-key.md)
138136
##### [Menu Command Properties](menu-command-properties.md)
139137
#### [String Editor](string-editor.md)
140138
##### [Finding a String](finding-a-string.md)

‎docs/windows/assigning-access-keys-to-menu-commands.md‎

Lines changed: 0 additions & 28 deletions
This file was deleted.
Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,63 @@
11
---
2-
title: "Associating a Menu Command with an Accelerator Key (C++)"
2+
title: "Associating Menu Commands (C++)"
33
ms.date: "11/04/2016"
4-
helpviewer_keywords: ["keyboard shortcuts [C++], menu association", "commands [C++], associating menu commands with accelerator keys", "menu commands [C++], associating with keyboard shortcuts"]
4+
helpviewer_keywords: ["keyboard shortcuts [C++], menu association", "commands [C++], associating menu commands with accelerator keys", "menu commands [C++], associating with keyboard shortcuts", "status bars [C++], associating menu items", "menus [C++], status bar text", "access keys [C++], checking", "menus [C++], shortcut keys", "keyboard shortcuts [C++], command assignments", "access keys [C++], assigning", "mnemonics [C++], adding to menus", "keyboard shortcuts [C++], uniqueness checking", "mnemonics [C++], uniqueness checking", "Check Mnemonics command"]
55
ms.assetid: ad2de43f-b20a-4c9f-bda8-0420179da48c
66
---
7-
# Associating a Menu Command with an Accelerator Key (C++)
7+
# Associating Menu Commands (C++)
88

9-
There are often times you want a menu command and a keyboard combination to issue the same program command. You do this by using the **Menu** editor to assign the same resource identifier to the menu command and to an entry in your application's accelerator table. You then edit the [Caption](../windows/menu-command-properties.md) of the menu command to show the name of the accelerator key.
9+
There are often times you want a menu command and a keyboard combination to issue the same program command. Identical commands are issued by using the **Menu** editor to assign the same resource identifier to the menu command and to an entry in your application's accelerator table. You then edit the [Caption](../windows/menu-command-properties.md) of the menu command to show the name of the accelerator key.
1010

11-
### To associate a menu command with an accelerator key
11+
For information on adding resources to managed projects, see [Resources in Desktop Apps](/dotnet/framework/resources/index) in the *.NET Framework Developer's Guide*. For information on manually adding resource files to managed projects, accessing resources, displaying static resources, and assigning resource strings to properties, see [Creating Resource Files for Desktop Apps](/dotnet/framework/resources/creating-resource-files-for-desktop-apps). For information on globalization and localization of resources in managed apps, see [Globalizing and Localizing .NET Framework Applications](/dotnet/standard/globalization-localization/index).
12+
13+
## To associate a menu command with an accelerator key
1214

1315
1. In the **Menu** editor, select the menu command you want.
1416

15-
2. In the [Properties Window](/visualstudio/ide/reference/properties-window), add the name of the accelerator key to the **Caption** property:
17+
1. In the [Properties Window](/visualstudio/ide/reference/properties-window), add the name of the accelerator key to the **Caption** property:
1618

1719
- Following the menu caption, type the escape sequence for a tab (\t), so that all the menu's accelerator keys are left aligned.
1820

1921
- Type the name of the modifier key (**Ctrl**, **Alt**, or **Shift**) followed by a plus sign (**+**) and the name, letter, or symbol of the additional key.
2022

21-
For example, to assign **Ctrl**+**O** to the **Open** command on the **File** menu, you modify the menu command's **Caption** so that it looks like this:
23+
For example, to assign **Ctrl**+**O** to the **Open** command on the **File** menu, you modify the menu command's **Caption** so that it looks like the following text:
2224

2325
```
2426
&Open...\tCtrl+O
2527
```
2628
2729
The menu command in the **Menu** editor is updated to reflect the new caption as you type it.
2830
29-
3. [Create the accelerator-table entry](../windows/adding-an-entry-to-an-accelerator-table.md) in the **Accelerator** editor and assign it the same identifier as the menu command. Use a key combination that you think will be easy to remember.
31+
1. [Create the accelerator-table entry](../windows/adding-an-entry-to-an-accelerator-table.md) in the **Accelerator** editor and assign it the same identifier as the menu command. Use a key combination that you think will be easy to remember.
32+
33+
## To associate a menu command with a status bar text string in MFC applications
34+
35+
Your MFC application can display descriptive text for each of the menu commands a user may select. Display descriptive text by assigning a text string to each menu command using the **Prompt** property in the **Properties** window. If you have a string in the [string table](../windows/string-editor.md) whose ID is the same as the command, an MFC application will automatically display this string resource in the status bar of the running application when a user hovers over a menu item.
36+
37+
1. In the **Menu** editor, select the menu command.
38+
39+
1. In the [Properties Window](/visualstudio/ide/reference/properties-window), type the associated status bar text in the **Prompt** box.
40+
41+
> [!NOTE]
42+
> This set of steps requires MFC.
43+
44+
## To assign an access (shortcut) key to a menu command
45+
46+
In a C++ project, you can assign an access key (a mnemonic that allows the user to select the menu with the keyboard) to your menus and menu commands.
47+
48+
Type an ampersand (`&`) in front of a letter in the menu name or command name to specify that letter as the corresponding access key. For example, "&File" sets **Alt**+**F** as the shortcut key for the **File** menu in applications written for Microsoft Windows.
49+
50+
The menu item will provide a visible cue that one of the letters has a shortcut key assigned to it. The letter following the ampersand will appear underlined (contingent on the operating system).
3051
31-
For information on adding resources to managed projects, please see [Resources in Desktop Apps](/dotnet/framework/resources/index) in the *.NET Framework Developer's Guide*. For information on manually adding resource files to managed projects, accessing resources, displaying static resources, and assigning resource strings to properties, see [Creating Resource Files for Desktop Apps](/dotnet/framework/resources/creating-resource-files-for-desktop-apps). For information on globalization and localization of resources in managed apps, see [Globalizing and Localizing .NET Framework Applications](/dotnet/standard/globalization-localization/index).
52+
> [!NOTE]
53+
> Make sure all the access keys on a menu are unique by right-clicking your menu and choosing **Check Mnemonics** from the shortcut menu.
3254
3355
## Requirements
3456
3557
Win32
3658
3759
## See Also
3860
61+
[Menu Editor](../windows/menu-editor.md)<br/>
3962
[Adding Commands to a Menu](../windows/adding-commands-to-a-menu.md)<br/>
40-
[Menu Editor](../windows/menu-editor.md)
63+
[Strings (ATL/MFC)](../atl-mfc-shared/strings-atl-mfc.md)<br/>

‎docs/windows/associating-menu-commands-with-status-bar-text-in-mfc-applications.md‎

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)