Page 1 of 1

keep track of moving body of text, inside trichedit

Posted: Tue Feb 24, 2015 3:03 pm
by Lucian
Hi,

I'd like to know if this is possible. It's about emails... forwarding emails. For example. Let's say the user wants to forward an email. A new email (form) is created, 2 empty lines are inserted in the body of the new email (at the top of the richedit control), than the old content is pasted in the richedit component (at the bottom):

THIS IS AN EMPTY LINE
THIS IS AN EMPTY LINE
The body of the old email from here...

Now, the user starts typing his stuff at the top of the new email and at some point it will go and edit the email address to whom the email will be sent (or pick an email from some list, etc). When that happens (an email address is picked up and that field is exited) the following SHOULD happen (at least that's what my boss wants):

A salutation line is inserted at the top of the email.
A signature is picked up and inserted AT CORRECT POSITION, exactly where the old email's body starts (and not where the cursor was when the user switched to the other field, because it may very well not be at the right place). So, in the end the new email looks like this:

Dear blah-blah

A lot of blah-blah-blah happens until it suddenly stops.
THIS IS AN EMPTY LINE
THIS IS AN EMPTY LINE
SIGNATURE LINE 1
SIGNATURE LINE 2
SIGNATURE LINE 3
The body of the old email from here...

My question is, is it possible to keep track of the exact position of where the old email starts? It could be an image, it could be anything HTML possible. Using markers like "&^%$##%" in order to just search for ... is not allowed obviously.

Thanks

Posted: Wed Feb 25, 2015 12:10 pm
by Sergey Tkachenko
You need to insert something invisible at the beginning of the quoted text.
For example, a checkpoint with a special tag.
Checkpoints may appear when loading HTML (anchors are loaded as checkpoints).
Checkpoints have two string properties - Name and Tag. When a anchor is loaded, its name is stored in the checkpoint name, all tags are empty.
So, if you insert a checkpoint with a filled Tag, it can be distinguished from other checkpoints.

Do you need a sample code?

Posted: Wed Feb 25, 2015 12:13 pm
by Lucian
Sergey Tkachenko wrote:...
Do you need a sample code?
Yes please, thank you very much!
Lucian

Posted: Wed Feb 25, 2015 12:14 pm
by Lucian
Sergey Tkachenko wrote:...Do you need a sample code?
I should be able to delete the checkpoint when finished.
Thanks