I made a TFrame in Delphi with a TRichViewEdit in it with buttons for alignement, color, font, font-size, etc...
If I paste a link inside an empty TRichViewEdit, I'm stuck inside the hyperlink. Whatever I try to type inside the edit goes in the Link label.
Is there something I can do right after a link is pasted to "finish" the link label so the next thing I type in is not in the link ?
The OnPaste event seems to be called before the paste is done and I don't know when it's an hyperlink.
Thanks
Stuck into HyperLink style when there is only a link inside
-
- Posts: 13
- Joined: Mon Jun 16, 2014 1:10 pm
-
- Site Admin
- Posts: 17524
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
The recommended solution is closing the link when the user types some characters that should not belong to the link, such as space characters.
If you use RichViewActions, you can use TrvActionInsertHyperlink.TerminateHyperlink. Search in the main form of the ActionTest demos for "rvActionInsertHyperlink1.TerminateHyperlink".
If you do not use RichViewActions, you can take as a sample the demo in Demos\DelphiUnicode\Assorted\Hypertext\CreateHyperlink. See TForm1.TerminateHyperlink.
There is also a demo Demos\DelphiUnicode\Assorted\Hypertext\URLs\.
It contains a ready-to-use URLScan.pas unit. It also provides TerminateHyperlink procedure. But this procedure works in conjunctions with the event OnItemTextEdit (see TForm1.rveItemTextEdit in this demo).
If you use RichViewActions, you can use TrvActionInsertHyperlink.TerminateHyperlink. Search in the main form of the ActionTest demos for "rvActionInsertHyperlink1.TerminateHyperlink".
If you do not use RichViewActions, you can take as a sample the demo in Demos\DelphiUnicode\Assorted\Hypertext\CreateHyperlink. See TForm1.TerminateHyperlink.
There is also a demo Demos\DelphiUnicode\Assorted\Hypertext\URLs\.
It contains a ready-to-use URLScan.pas unit. It also provides TerminateHyperlink procedure. But this procedure works in conjunctions with the event OnItemTextEdit (see TForm1.rveItemTextEdit in this demo).