TdxCustomLayoutItemCaptionOptions.Text Property
Specifies a layout element‘s caption.
Declaration
property Text: string read; write;
Property Value
Type |
---|
string |
Remarks
Use this property to assign a text string to a layout element’s caption that supports accelerator characters and limited text formatting options.
An accelerator character allows a user to jump to a specific layout element via a key combination. Insert the ampersand (&) before a character in the item’s caption and set the ShowAccelChar property value to True to underline the accelerator character. Every time a user presses the Alt+(accelerator character) key combination, the focus moves to the corresponding item even if it is contained in the collapsed layout group.
All layout elements (except for tabbed layout groups) support formatted text in the caption. You can associate a layout element with a text string at design and runtime via BBCode-inspired tags.
Design Time
You can edit a caption via the “Formatted Text Editor” dialog whose functionality is similar to the “Formatted Label Editor“ dialog, except for the ability to create hyperlinks.
To invoke the formatted text editor, select a layout element and click the ellipsis button of its CaptionOptions.Text property in the Object Inspector.
Runtime
Enclose a text string in the corresponding tags to add it to a layout element’s caption:
The table below shows BB-code inspired tags that you can use to format a layout element’s caption:
Group | Tag | Example | Description |
---|---|---|---|
Font Settings | [FONT][/FONT] | The font typeface. | |
[NOPARSE][/NOPARSE] | A text range in which all markup tags are ignored. | ||
Style | [B][/B] | The bold, italic, underline, and strikeout font attributes. | |
[I][/I] | |||
[U][/U] | |||
[S][/S] | |||
Size | [SIZE][/SIZE] | The font size, superscript, and subscript attributes. | |
[SUP][/SUP] | |||
[SUB][/SUB] | |||
Color | [COLOR][/COLOR] | The font and highlight colors. | |
[BACKCOLOR][/BACKCOLOR] |
The formatted text does not apply to:
A layout element‘s caption if you browse it in the Customization Form.
A layout group’s caption if the group or the control uses standard look-and-feel style.
A caption of a layout group and separator item when printing.
Localization
You can use this property to localize the layout element’s caption. The code example below shows how to update the default captions of all items in the layout group (dxLayoutGroup1) with the Text property:
var
I: Integer;
begin
dxLayoutControl1.BeginTranslation;
for I := 0 to dxLayoutGroup1.Count - 1 do
begin
dxLayoutGroup1.Items[I].CaptionOptions.Text := '[I]Custom Layout Item' + IntToStr(I)+ '[/I]';
end;
dxLayoutControl1.EndTranslation;
end;