You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2f68169
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/windows/creating-a-menu.md
+43-6Lines changed: 43 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,24 +2,26 @@
2
2
title: "Creating a Menu (C++)"
3
3
ms.date: "11/04/2016"
4
4
f1_keywords: ["vc.editors.menu"]
5
-
helpviewer_keywords: ["mnemonics [C++], associating menu items", "menus [C++], associating commands with mnemonic keys", "menus [C++], creating"]
5
+
helpviewer_keywords: ["mnemonics [C++], associating menu items", "menus [C++], associating commands with mnemonic keys", "menus [C++], creating", "menus [C++], adding items", "commands [C++], adding to menus", "menu items, adding to menus"]
6
6
ms.assetid: 66f94448-9b97-4b73-bf97-10d4bf87cc65
7
7
---
8
8
# Creating a Menu (C++)
9
9
10
10
> [!NOTE]
11
11
> The **Resource Window** is not available in Express editions.
12
12
13
-
### To create a standard menu
13
+
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).
14
14
15
-
1. From the **View** menu, click on **Resource View** and then right-click on the **Menu** heading and choose **Add Resource**. Choose **Menu**.
15
+
## To create a standard menu
16
16
17
-
2. Select the **New Item** box (the rectangle that contains "Type Here") on the menu bar.
17
+
1. From the **View** menu, select **Resource View** and then right-click on the **Menu** heading and choose **Add Resource**. Choose **Menu**.
18
+
19
+
1. Select the **New Item** box (the rectangle that contains "Type Here") on the menu bar.
18
20
19
21
<br/>
20
22
New Item Box
21
23
22
-
3. Type a name for your new menu, for example, "File".
24
+
1. Type a name for your new menu, for example, "File".
23
25
24
26
The text you type appears in both the **Menu** editor and in the **Caption** box in the [Properties Window](/visualstudio/ide/reference/properties-window). You can edit the properties for your new menu in either location.
> To create a single-item menu on the menu bar, set the **Popup** property to **False**.
33
35
34
-
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).
36
+
## To insert a new menu between existing menus
37
+
38
+
Select an existing menu name and press the **Insert** key. The **New Item** box is inserted before the selected item.
39
+
40
+
\- or -
41
+
42
+
Right-click on the menu bar and choose **Insert New** from the shortcut menu.
43
+
44
+
## To add commands to a menu
45
+
46
+
1. Create a menu.
47
+
48
+
1. Select a menu name, for example, **File**.
49
+
50
+
Each menu will expand and expose a new item box for commands. For example, you can add the commands **New**, **Open**, and **Close** to a **File** menu.
51
+
52
+
1. In the new item box, type a name for the new menu command.
53
+
54
+
> [!NOTE]
55
+
> The text you type appears in both the **Menu** editor and in the **Caption** box in the [Properties Window](/visualstudio/ide/reference/properties-window). You can edit the properties for your new menu in either location.
56
+
57
+
> [!TIP]
58
+
> You can define a mnemonic key (hot key) that allows the user to select the menu command. Type an ampersand (`&`) in front of a letter to specify it as the mnemonic. The user can select the menu command by typing that letter.
59
+
60
+
1. In the **Properties** window, select the menu command properties that apply. For details, see [Menu Command Properties](../windows/menu-command-properties.md).
61
+
62
+
1. In the **Prompt** box in the **Properties** window, type the prompt string you want to appear in your application's status bar.
63
+
64
+
This step creates an entry in the string table with the same resource identifier as the menu command you created.
65
+
66
+
> [!NOTE]
67
+
> Prompts can only apply to menu items with a **Popup** property of **True**. For example, top-level menu items can have prompts if they have sub-menu items. The purpose of a **Prompt** is to indicate what will happen if a user selects the menu item.
68
+
69
+
1. Press **Enter** to complete the menu command.
70
+
71
+
The new item box is selected so you can create additional menu commands.
0 commit comments