vcl-cxcontrols-dot-tdxhyperlinkeventargs-adf2348e.md
Provides access to the target hyperlink’s parent UI element.
property Item: TObject read;
| Type | Description |
|---|---|
| TObject |
The target hyperlink’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 Item.ClassType function or use other RTTI functionality to identify the actual parent control or UI element type.
|
You can use the Item property to identify and access the parent UI element of the occurred event’s target hyperlink. The HyperlinkIndex property allows you to identify the target hyperlink’s position in the parent UI element’s message.
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 EditorsThe actual Item type is TdxFormattedLabel or TdxDBFormattedLabel. AArgs.Item and Sender parameter values always match in the parent event’s handler.Layout ControlThe actual Item type is always the corresponding terminal TdxCustomLayoutItem descendant.
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.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;
void __fastcall TMyForm::dxLayoutControl1HyperlinkMouseEnter(TObject *Sender,
TdxHyperlinkEventArgs *AArgs) // Displays the hyperlink target in the form caption
{
TdxCustomLayoutItem *ATargetItem;
ATargetItem = dynamic_cast<TdxCustomLayoutItem*>(AArgs->Item); // Obtains the target layout item
Caption = "Target Item: " + ATargetItem->CaptionOptions->Text + "; Navigate to " + AArgs->URI;
}
void __fastcall TMyForm::dxLayoutControl1HyperlinkMouseLeave(TObject *Sender,
TdxHyperlinkEventArgs *AArgs) // Displays the predefined string instead of a hyperlink target
{
Caption = "Hyperlink Navigation in Layout Item Captions";
}
See Also
TdxHyperlinkEventArgs.Text Property