Inserttext into rich text

General TRichView support forum. Please post your questions here
Post Reply
mcperes
Posts: 6
Joined: Thu Jan 04, 2018 10:38 pm

Inserttext into rich text

Post by mcperes »

I want to insert items from a dbgrid into the text, I will use drag and drop, so far so good, I know how to do. The problem is that when using a data from a dbgrid I need to change the color of the line and in case the user deletes the dragged text, dbgrid needs to return the line to normal.
I thought of leaving a comment within the text dragged in rich text using {\ * \ annotdef ...} - it would contain a reference to the database field that I would read to update the gride and - if the user deletes the inserted text, the comment would be erased together - also allowing you to update the gride, but to make it right I would have to drag the text into the code at the rich text level, and I only saw the inserttext method that I do not think inserts at that text level.
Sergey Tkachenko
Site Admin
Posts: 17522
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Inserttext into rich text

Post by Sergey Tkachenko »

The current version of TRichView does not support annotdef RTF code.
If you need to insert a field, you can use InsertStringTag. Encode some information in tag string, allowing to identify the grid cell.

See the example: Demos\DelphiUnicode\Assorted\Fields\LiveLink\Tables\
mcperes
Posts: 6
Joined: Thu Jan 04, 2018 10:38 pm

Re: Inserttext into rich text

Post by mcperes »

right, but when I insert fields in this way I can not export to rtf and then reopen and have access to the ids of those fields?
Sergey Tkachenko
Site Admin
Posts: 17522
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Inserttext into rich text

Post by Sergey Tkachenko »

Unfortunately, RTF annotations and merge fields are not supported yet, so you can save all additional information only in RVF files.
Post Reply