Caption Property

Returns or sets the text displayed on the object.

Syntax

Object.Caption [ = sCaption ]

The Caption property syntax has the following parts:

 

Name

Type

Description

Object

A Control, AForm, AMenu

A control object, the AForm object, or the AMenu object.

sCaption

BString

A string expression that evaluates to the text displayed as the caption.

Comments

When you create a new control, its default caption is the default Name property setting. This default caption includes the control class name and an integer, such as btn1 or Form1.

You can use the Caption property to assign an access key to a control. In the caption, include an ampersand (&) immediately preceding the character you want to designate as an access key. The character is underlined. Press the ALT key plus the underlined character to move the focus to that control or the following one that can receive the focus. To include an ampersand in a caption without creating an access key, include two ampersands (&&). A single ampersand is displayed in the caption and no characters are underlined.

From ATEasy Version 6, AButton, ARadioButton, ACheckBox new support for multiple lines text and word wrap for the Caption property is automatically applied; that is, if the button height is big enough to include multi line text, it will be displayed as multi line, otherwise it will be displayed in a single line as truncated.

Example

The following statement changes the Caption of an ACheckBox :

chkTestByTest.Caption="&Use the default"

Applies to

 

AButton

ACheckBox

AGroupBox

AMenu

ASlider

AChart

AForm

ALabel

ARadioButton

 ASwitch

See Also

Description, Name, Tag, Text