vcl-dxlayoutcontainer-dot-tdxcustomlayoutitem-ca3f5237.md
Allows you to change a hyperlink hint before it appears.
property OnShowHyperlinkHint: TdxShowHyperlinkHintEvent read; write;
A hyperlink defined in the layout item’s caption can display the target URI in a hint when a user hovers the mouse pointer over the hyperlink. You can handle the OnShowHyperlinkHint event to change the hyperlink hint message for any hyperlink in the layout item.
The OnShowHyperlinkHint event occurs every time a hyperlink hint is about to appear.
The following parameters are accessible within an OnShowHyperlinkHint event handler:
SenderProvides access to the layout item that raised the hyperlink hint display event.AArgsProvides access to information related to the hyperlink hint display event that occurred. You can use the AArgs.Hint property to change hint text.
Refer to TdxShowHyperlinkHintEvent and TdxShowHyperlinkHintEventArgs type descriptions for detailed information on all options available within an OnShowHyperlinkHint event handler.
The code example in this section demonstrates OnHyperlinkClick and OnShowHyperlinkHint event handlers. The OnHyperlinkClick handler requires a user to hold down the Ctrl key to activate a hyperlink. The OnShowHyperlinkHint event handler changes all hyperlink hints to prompt a user to hold the Ctrl key for hyperlink activation.
procedure TMyForm.dxLayoutControlItem1HyperlinkClick(Sender: TObject;
AArgs: TdxHyperlinkClickEventArgs);
begin
if AArgs.Shift <> [ssCtrl] then // If the Ctrl key is not held down
AArgs.Handled := True; // Prevents hyperlink activation
end;
procedure TMyForm.dxLayoutControl1Item1ShowHyperlinkHint(Sender: TObject;
AArgs: TdxShowHyperlinkHintEventArgs);
var
AHintPrefix, AHintURI: string;
begin
AHintPrefix := 'Ctrl-click to navigate to ';
AHintURI := AArgs.URI.Remove(0, 8); // Removes the URI scheme from the hyperlink hint
AArgs.Hint := AHintPrefix + AHintURI; // Redefines the hyperlink hint
end;
void __fastcall TMyForm::dxLayoutControl1Item1HyperlinkClick(TObject *Sender,
TdxHyperlinkClickEventArgs *AArgs)
{
if(AArgs->Shift != (TShiftState() << [ssCtrl])) // If the Ctrl key is held down
AArgs->Handled = true; // Prevents hyperlink activation
}
void __fastcall TMyForm::dxLayoutControl1Item1ShowHyperlinkHint(TObject *Sender,
TdxShowHyperlinkHintEventArgs *AArgs)
{
UnicodeString AHintPrefix, AHintURI;
AHintPrefix = "Ctrl-click to navigate to ";
AHintURI = AArgs->URI.Remove(0, 8); // Removes the URI scheme from the hyperlink hint
AArgs->Hint = AHintPrefix + AHintURI; // Redefines the hyperlink hint
}
See Also
TdxCustomLayoutItem.OnHyperlinkClick Event
TdxCustomLayoutItem.OnHyperlinkMouseEnter Event
TdxCustomLayoutItem.OnHyperlinkMouseLeave Event