TdxCustomFormattedLabelProperties.OnShowHyperlinkHint Event
Allows you to change a hyperlink hint before it appears.
Declaration
property OnShowHyperlinkHint: TdxShowHyperlinkHintEvent read; write;
Remarks
A hyperlink defined in the formatted label 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 formatted label.
Event Occurrence
The OnShowHyperlinkHint
event occurs every time a hyperlink hint is about to appear.
Note
Hyperlink hints can appear only if the ShowHyperlinkHint property is set to True
(default).
Event Parameters
Sender
- Provides access to the formatted label 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
The code example in this section demonstrates handlers of OnHyperlinkClick and OnShowHyperlinkHint
events. The OnHyperlinkClick event 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.dxFormattedLabel1PropertiesHyperlinkClick(Sender: TObject;
AArgs: TdxHyperlinkClickEventArgs); // Requires the Ctrl key for hyperlink activation
begin
if AArgs.Shift <> [ssCtrl] then // If the Ctrl key is not held down
AArgs.Handled := True; // Prevents hyperlink activation
end;
procedure TMyForm.dxFormattedLabel1PropertiesShowHyperlinkHint(Sender: TObject;
AArgs: TdxShowHyperlinkHintEventArgs); // Changes all hyperlink hints
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;