Skip to main content
All docs
V25.2
  • TdxHyperlinkClickEventArgs.URI Property

    Specifies the target URI of the clicked hyperlink.

    Declaration

    property URI: string read; write;

    Property Value

    Type Description
    string

    The target URI of the clicked hyperlink.

    Remarks

    Use the URI property to identify the clicked hyperlink’s target URI or change it.

    The code example in this section demonstrates OnHyperlinkClick and OnCreate event handlers. The OnHyperlinkClick event handler prevents users from activating a hyperlink that contains the MAILTO URI scheme. The OnCreate event handler associates the OnHyperlinkClick event handler with all layout items at startup.

    This scenario can be useful if you define layout item captions at runtime.

    uses
      System.StrUtils;  // Declares the ContainsText global function
    // ...
    
    procedure TMyForm.dxLayoutControl1Item1HyperlinkClick(Sender: TObject;
      AArgs: TdxHyperlinkClickEventArgs);
    begin
      if ContainsText(AArgs.URI, 'mailto') then  // If the clicked hyperlink contains the "mailto" URI scheme
        AArgs.Handled := True;  // Prevents hyperlink activation
    end;
    
    procedure TMyForm.FormCreate(Sender: TObject);  // Associates all layout items with the declared handler
    var
      I: Integer;
    begin
      for I := 0 to dxLayoutControl1.AbsoluteItemCount - 1 do  // Iterates through all layout items
        dxLayoutControl1.AbsoluteItems[I].OnHyperlinkClick := dxLayoutControl1Item1HyperlinkClick;
    end;
    
    See Also