TdxOwnerItemAnchorTextEventArgs.OwnerItem Property
Allows you to access the formatted text range’s parent UI element.
Declaration
property OwnerItem: TObject read;
Property Value
| Type | Description |
|---|---|
| TObject | The target formatted text range’s parent UI element. Cast this parameter value to the corresponding terminal control or UI element class to access all public API members. Refer to the following section for detailed information on parent UI element types in different DevExpress products: Parent UI Element Types. Tip You can call the |
Remarks
You can use the OwnerItem property to identify and access the parent UI element of the target hyperlink or hint-marked text range. The HyperlinkIndex property allows you to identify the target text range’s position in the parent UI element’s message.
Parent UI Element Types
The actual type of the parent UI element accessible through the Items property depends on the class that declares the corresponding hyperlink-related event:
- Formatted Label Editors
- The actual
OwnerItemtype is TdxFormattedLabel or TdxDBFormattedLabel.AArgs.OwnerItemandSenderparameter values always match within a handler. - Layout Control
- The actual
OwnerItemtype is always the corresponding terminal TdxCustomLayoutItem descendant.
Code Example: Display Target URIs of Hot-Tracked Hyperlinks in Layout Items
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 CaptionOptions.ShowHyperlinkHint property of a layout item is set to bFalse, for example).
procedure TMyForm.dxLayoutControl1HyperlinkMouseEnter(Sender: TObject;
AArgs: TdxHyperlinkEventArgs); // Displays the hyperlink target in the form caption
var
ATargetItem: TdxCustomLayoutItem;
begin
ATargetItem := AArgs.OwnerItem 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;