Menu Resources

Menus are composed of items whose properties can be changed. Among these properties, caption, ID and other appearance properties can be found. (These define how the selected item will be drawn.)

In each menu on the screen, a special item that allows users to create new items is present. This item can be easily spotted, because its color is different to the other items, and its caption is always "Type here". It is positioned at the end of each menu or submenu, so a new item must be created at the end of a menu. To insert a new item anywhere in a menu, create the item at the end, and drag it where you want. To create a new item, you must select a special item, click on it, and type the desired caption.

For more information, see the menu reference on the MSDN website.

Here is a short description of the menu item properties:

Caption

The caption property specifies the text that the item will display. It may also contain an accelerator, which will appear to the right of the menu's caption. In this case, the text and the accelerator are separated with the '\t' character.

For example, if the text is "Open", and the accelerator is "Ctrl+N", then the menu item caption will be "Open\tCtrl+N".

This property is not available when the item is an accelerator.

Checked

When this property is true, a checkbox is printed at left side of the item.

This property is not available when the item is an accelerator.

Inactive

When this property is true, the user cannot select the menu item. The item's appearance, however, is not any different from an active item.

This property is not available when the item is an accelerator.

Grayed

When this property is true, the menu item text will be gray in color. The item also becomes inactive (see previous paragraph), and it therefore cannot be selected.

This property is not available when the item is an accelerator.

Popup

When this property is true, the menu item is a popup-menu. This means that the item contains a sub-menu.

When this property is changed to false, any existing sub-menu of the selected menu item will be deleted.

When this property is changed to true, a new sub-menu (with no items) is created.

This property is not available when the item is an accelerator.

Separator

When this property is true, the menu item is a separator. In this case, none of the properties are available (no caption, no ID, etc...). However, all these properties are saved when an item becomes a separator; if the separator property was previously set to false, its original properties will be retained.

ID

The ID defines the menu item. However, it is not unique, and it is not always possible to find an item only with its ID. Not all of the items require IDs; separators and popup-menus do not use them.

When a new item is created, the ID is generated from the item's caption. It always begin with the "IDM_" string, and the caption string is appended. Lower-case letters are converted to upper-case, numbers are retained, and all other characters are replaced with underscore characters.

For example, if the item caption is "Some text", then the ID will be "IDM_SOME_TEXT".

Of course, it is possible to change the item's ID after its creation.


Copyright 2006-2008 | Contact.