Page 1 of 1

Inserttext into rich text

Posted: Thu Jan 04, 2018 10:54 pm
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.

Re: Inserttext into rich text

Posted: Fri Jan 05, 2018 6:27 pm
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\

Re: Inserttext into rich text

Posted: Fri Jan 05, 2018 6:43 pm
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?

Re: Inserttext into rich text

Posted: Sat Jan 06, 2018 8:36 am
by Sergey Tkachenko
Unfortunately, RTF annotations and merge fields are not supported yet, so you can save all additional information only in RVF files.