Insert new text and keeping the selecion

General TRichView support forum. Please post your questions here
Post Reply
Prometeus
Posts: 16
Joined: Tue Jan 20, 2009 1:58 pm

Insert new text and keeping the selecion

Post by Prometeus »

Hello,



I need to do some processing in a selected text and after that (the text will have the same length as before) keep the selection. I tried doing that:

Code: Select all

rv.Format;
rv.GetSelectionBounds(StartItemNo,StartItemOffs,EndItemNo,EndItemOffs,false);
work_str := rv.GetSelText;
...
(Do some text processing on 'work_str')
...
rv.InsertText(work_str,true);
rv.Format;
rv.SetSelectionBounds(StartItemNo,StartItemOffs,EndItemNo,EndItemOffs);
Unfortunatelly this did not work. I tried looking other topics about similar situation but found nothing. How can I do that?

Thanks for any help.
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Use the function from RVLinear.pas: http://www.trichview.com/help/idh_rvlinear.html
Prometeus
Posts: 16
Joined: Tue Jan 20, 2009 1:58 pm

Post by Prometeus »

Hello, Sergey,



It worked perfectly!


Thanks!
Post Reply