Page 1 of 1

Why Tag didn't close?

Posted: Thu Jun 17, 2010 10:03 am
by x_ginger
I pasted into TRichViewEdit text "Images and hyperlinks" that contained a hyperlink "http://www.richedit.com/forums/viewtopic.php?t=3654". It was copied from Micrisoft Word. Then I started to input some letters, but format wasn't changed! I thought the hyperlink shall close when pasting ended?
Or after saving in database when I write down letters after the hyperlink, the same trouble - text is formatted as hyperlink, and tag is included...

Is it right policy?

Posted: Sun Jun 20, 2010 6:22 pm
by Sergey Tkachenko
There are procedures for URL detection and hyperlink termination on typing. You need to call then when the user pressed Enter, Tab, space and comma characters.
If you use RichViewActions, use TrvActionInsertHyperlink's DetectURL and TerminateHyperlink methods. Example can be found in the ActionTest demo.
If you do not use RichViewActions, use the unit URLScan.pas from the demo Assorted/Hypertext/URLs.
This unit contains the functions DetectURL and TerminateHyperlink. Example can be found in this demo.