TdxCustomLayoutControl.OnShowHyperlinkHint Event
Allows you to change a hyperlink hint before it appears.
Declaration
property OnShowHyperlinkHint: TdxShowHyperlinkHintEvent read; write;
Remarks
A hyperlink defined in a layout item 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 any layout item.
Layout Control and Layout Item Events
The OnShowHyperlinkHint
event allows you to implement a common hint display handler for all layout items in the control. Alternatively, you can handle the OnShowHyperlinkHint event of individual layout items.
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 control 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. To identify and access the target hyperlink’s parent layout item, use theAArgs
.Item property.
Refer to TdxShowHyperlinkHintEvent and TdxShowHyperlinkHintEventArgs type descriptions for detailed information on all options accessible within an OnShowHyperlinkHint
event handler.
Code Example: Prevent Accidental Hyperlink Activation in All 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.dxLayoutControl1HyperlinkClick(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.dxLayoutControl1ShowHyperlinkHint(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;