<< Click to display table of contents >> TrvActionInsertHyperlink.DetectURL |
Helps to detect URLs on typing in rve.
procedure DetectURL(rve: TCustomRichViewEdit);
This action checks the text to the left of the caret position, and if its a URL, converts it to a hyperlink.
The function does nothing of the text is already a hyperlink, or if the selection in rve is not empty.
The method uses GetHyperlinkStyleNo for this conversion.
Example [VCL]:
procedure TForm1.RichViewEdit1KeyPress(Sender: TObject; var Key: Char);
begin
if Key in [#9, ' ', ',', ';'] then begin
rvActionInsertHyperlink1.DetectURL(RichViewEdit1);
rvActionInsertHyperlink1.TerminateHyperlink(RichViewEdit1);
end;
end;
You should call this method:
•in OnKeyPress event (in OnUTF8KeyPress for Lazarus) when the user types tab, space, comma or semicolon characters
•in OnKeyDown event when the user pressed ENTER