Page 1 of 1
Hyperlink
Posted: Sun Feb 16, 2020 8:29 am
by etwoss
Hi
Perhaps simple question: how can i, from Delphi code, insert a hyperlink like
a href="https://someurl">Visit W3Schools</a>
Into the RichEdit
Thanks for anwering
Eric
Re: Hyperlink
Posted: Sun Feb 16, 2020 7:31 pm
by Sergey Tkachenko
I assume that your question is about our components (TRichViewEdit), not about the standard TRichEdit.
Do you use RichViewActions?
If yes, the simplest way is to use TrvActionInsertHyperlink:
Code: Select all
rve.CurTextStyleNo := rvActionInsertHyperlink1.GetHyperlinkStyleNo(rve);
rve.InsertStringTag('Visit W3Schools', 'https://someurl');
You need to process OnJump event to open the clicked link in browser (or perform other operation):
Code: Select all
procedure TForm3.rveJump(Sender: TObject; id: Integer);
begin
rvActionInsertHyperlink1.GoToLink(rve, id);
end;
If you do not use RichViewActions, it would require more code (to specify hyperlink attributes), see the demo in <TRichView Dir>\TRichView\Demos\DelphiUnicode\Assorted\Hypertext\CreateHyperlink\