How do I insert a hyperlink into the text inside a TRichEdit control in Delphi?
Posted on 2010-01-12
What I want to do is to give the user the facility to insert a reference to a document in the middle of some free text - the reference is sensitive to 'MouseOver' and 'OnClick' events;
For example, the user will type "The company safety policy consists of " and then he/she will click a button to insert a reference at the last carat position. The text now reads..."The company safety policy consists of RIDORR Sections 1 to 5" where "RIDORR Sections 1 to 5" is the reference that is mouse-sensitive.
I want the reference to change colour when the mouse is hovering over it and when the user clicks on the reference I will call up another Form to display the content of the reference. To do all this requires first of all that the reference is somehow made mouse-sensitive. Added to this, the string that forms the reference has to act as a single character when it comes to deletion - the user will delete the whole string with a single 'backspace' keystroke, no partial deletion of the reference is allowed.
This looks very difficult hence the high tariff.
I would consider using a TMemo control instead of TRichEdit if that makes it easier.
Thanks in advance.