TdxCustomLayoutItem.OnShowHyperlinkHint Event
Allows you to change a hyperlink hint before it appears.
Declaration
property OnShowHyperlinkHint: TdxShowHyperlinkHintEvent read; write;
Remarks
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.
Event Occurrence
The OnShowHyperlinkHint
event occurs every time a hyperlink hint is about to appear.
Event Parameters
The following parameters are accessible within an OnShowHyperlinkHint
event handler:
Sender
- Provides access to the layout item that raised the hyperlink hint display event.
AArgs
- Provides 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.
Code Example: Prevent Accidental Hyperlink Activation in Layout Items
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;