TdxCustomLayoutItemCaptionOptions.Text Property
Specifies the layout item‘s caption.
#Declaration
property Text: string read; write;
#Property Value
Type | Description |
---|---|
string | The layout item caption, with support for BBCode-inspired markup syntax and accelerator characters. Refer to the Remarks section for detailed information on supported formatting options. |
#Remarks
Use the Text
property to specify a caption of the layout item. Layout item captions support multiple formatting options and can include accelerator characters.
#BBCode-Inspired Formatting Markup
Layout item captions support multiple BBCode-inspired formatting tags that allow you to define hyperlinks and apply different formatting attributes to text – bold, italic, superscript, underline, etc. All layout items except for tabbed layout groups support caption formatting.
Refer to the following topic for detailed information on all supported markup tags and design-time functionality: BBCode-Inspired Text Formatting Markup.
#Code Example: Add a Hyperlink to a Layout Item Caption
The following code example defines a layout item caption with custom formatting that includes a hyperlink:
dxLayoutItem1.CaptionOptions.HyperlinkColor := clWebOrange;
dxLayoutItem1.CaptionOptions.Text := 'Visit [B]our page[/B]: ' +
'[URL=https://www.devexpress.com]DevExpress[/URL]';
Tip
To change the predefined hyperlink activation behavior, you can handle the layout item’s On
#Accelerator Character
An accelerator character (&) allows you to define a keystroke required to navigate to a layout item. Insert &
before the required character to mark it as accelerator in the Text
string. The resulting Alt + Accelerator Character keystroke moves focus to the corresponding layout item, even if it is within a collapsed layout group.
The layout item caption displays its accelerator character if the ShowAccelChar property is set to True
(default).
#Code Example: Display Target URIs of Hot-Tracked Hyperlinks
The code example in this section demonstrates OnHyperlinkMouseEnter and OnHyperlinkMouseLeave event handlers that update the form caption as the mouse pointer moves between layout item hyperlinks.
The OnHyperlinkMouseEnter event handler displays the caption of the target layout item followed by the URI of a hyperlink in the form caption when the mouse pointer enters a hyperlink area. The OnHyperlinkMouseLeave event handler changes the form caption to a predefined string when the mouse pointer leaves a hyperlink.
Tip
This scenario can be useful if you need to display hyperlink targets without hints (if the Caption
procedure TMyForm.dxLayoutControl1HyperlinkMouseEnter(Sender: TObject;
AArgs: TdxHyperlinkEventArgs); // Displays the hyperlink target in the form caption
var
ATargetItem: TdxCustomLayoutItem;
begin
ATargetItem := AArgs.Item as TdxCustomLayoutItem; // Obtains the target layout item
Caption := 'Target Item: ' + ATargetItem.CaptionOptions.Text + '; Navigate to ' + AArgs.URI;
end;
procedure TMyForm.dxLayoutControl1HyperlinkMouseLeave(Sender: TObject;
AArgs: TdxHyperlinkEventArgs); // Displays the predefined string instead of a hyperlink target
begin
Caption := 'Hyperlink Navigation in Layout Item Captions';
end;