Skip to main content

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.

Formatted Text Editor

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:

dxLayoutItem1.CaptionOptions.Text := '[B]A Layout Item[/B]';

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 Tag Example

The font typeface.

[NOPARSE][/NOPARSE]

The NOPARSE Tag Example

A text range in which all markup tags are ignored.

Style

[B][/B]

Bold

The bold, italic, underline, and strikeout font attributes.

[I][/I]

Italic

[U][/U]

Underline

[S][/S]

Strikeout

Size

[SIZE][/SIZE]

The SIZE Tag Example

The font size, superscript, and subscript attributes.

[SUP][/SUP]

The SUP Tag Example

[SUB][/SUB]

The SUB Tag Example

Color

[COLOR][/COLOR]

The COLOR Tag Example

The font and highlight colors.

[BACKCOLOR][/BACKCOLOR]

The BACKCOLOR Tag Example

The formatted text does not apply to:

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;
See Also