caption

Type: String[100]

Availability: Read or write at any time

The caption property of the MenuItem class contains the text displayed in the menu item caption.

You can use the caption property to assign an access key to a menu. In the caption, include an ampersand character (&) immediately preceding the character that you want for an accelerator key. The accelerator key character is underlined. To activate that menu or item, press Alt and the key of the underlined character.

To include an ampersand in a caption without creating an access key, enter two ampersand characters (&&). A single ampersand is displayed in the caption and no character is underlined.

This property can be translated when the value of the Schema class formsManagement property is FormsMngmt_Single_Multi (2).

The code fragment in the following example shows the use of the caption property.

// For multilanguage, check locale and display the appropriate message string
MenuItemGreeting.caption := $Hello;

To dynamically add a separator to a menu at run time, specify a caption property value of "-" (that is, a hyphen character) so that the item is displayed as a separator line when the menu is displayed.

The maximum length of a menu caption is 100 characters.