OnLinkClicked - DfBaseRichEdit
Fires when hyperlink in text is clicked
Type: Event
Parameters
| Parameter | Type | Description |
|---|---|---|
| iPositionStart | integer | The starting position of the hyperlink |
| iPositionEnd | integer | The ending position of the hyperlink |
Syntax
Procedure OnLinkClicked integer iPositionStart integer iPositionEnd
Description
Returns the starting and ending positions of the link clicked by the user.
The character position is the zero-based absolute position of the character in the control. The first position in the first line is always 0. If the first line in the control contains 20 characters, the first position in the second line will be 20.
Sample
This sample retrieves the text of the link that was clicked via TextRange. You can add your own handling of the link text in the begin...end code block.
Procedure OnLinkClicked integer iPositionStart integer iPositionEnd
string sLinkText
get TextRange iPositionStart iPositionEnd to sLinkText
if (sLinkText <> "") begin
// do something
end
End_Procedure // OnLinkClicked
Sample
This sample retrieves the text of the link that was clicked via TextRange. Afterwards, if the link text is not blank, it launches the link in the default browser using the ShellExecute Windows API call.
Procedure OnLinkClicked integer iPositionStart integer iPositionEnd
handle hInstance hWnd
string sLinkText
get TextRange iPositionStart iPositionEnd to sLinkText
if (sLinkText <> "") begin
Get Window_Handle To hWnd
Move (ShellExecute (hWnd, "open", (Trim (sLinkText)), '', '', 1)) To hInstance
end
End_Procedure // OnLinkClicked