Skip to content

psCaption - cCJAction

Gets and sets the caption text that appears in a menu or toolbar item

Type: Property
Access: Read/Write
Data Type: String
Parameters: None

Syntax

Property String psCaption
Access Type Syntax
Read Access: Get psCaption to StringVariable
Write Access: Set psCaption to StringVariable/Value

Description

psCaption is used to set and get the caption text that appears in a menu or toolbar item. The text will appear in all controls that support the display of text.

The "&" character is used to designate the following character as a quick access key. In the menu it will appear with an underscore. If no letter in the caption is preceded by "&", the first letter of the caption is used instead. Quick access keys are triggered by pressing Alt+the designated letter on the keyboard. If more than one menu item at the same object level use the same quick access key letter, subsequent presses of that key combination rotates through the items.

Sample

In this sample, pressing Alt+S will trigger the menu item.

Object oMyMenuItem is cCJMenuItem
    Set psCaption to "&Select Me"
    Set psToolTip to "Select Me in tooltip"
    Set psDescription to "Select Me in idle statusbar pane"
    Set psImage to "SelectMe.ico"

    Procedure OnExecute Variant vCommandBarControl
        Showln "Select Me was selected"
    End_Procedure   
End_Object

To display an ampersand (&) in a caption, use two ampersand characters.

Set psCaption to 'Save && Display'

See Also

psTooltip | psDescription | psShortcut