Back to Devexpress

TdxCustomLayoutControl.OnShowHyperlinkHint Event

vcl-dxlayoutcontrol-dot-tdxcustomlayoutcontrol-7ae8083d.md

latest4.5 KB
Original Source

TdxCustomLayoutControl.OnShowHyperlinkHint Event

Allows you to change a hyperlink hint before it appears.

Declaration

delphi
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:

SenderProvides access to the layout control 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. To identify and access the target hyperlink’s parent layout item, use the AArgs.Item property.

Refer to TdxShowHyperlinkHintEvent and TdxShowHyperlinkHintEventArgs type descriptions for detailed information on all options accessible 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.

delphi
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;
cpp
void __fastcall TMyForm::dxLayoutControl1HyperlinkClick(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::dxLayoutControl1ShowHyperlinkHint(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

TdxCustomLayoutControl.OnHyperlinkClick Event

TdxCustomLayoutControl.OnHyperlinkMouseEnter Event

TdxCustomLayoutControl.OnHyperlinkMouseLeave Event

BBCode-Inspired Text Formatting Markup

TdxCustomLayoutControl Class

TdxCustomLayoutControl Members

dxLayoutControl Unit