Hi,
I would like to replace a manually selected text in rvedit leaving the selection.
Actually, I select the text, use InsertText to replace the text. But, in this way, I loose the selection
Hope I was clear ....
Replace selection
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Ok, I try to explain better my problem (sorry for my poor english).
I have this
I want to replace the selected text with "stunning autos"
so I use
rv->InsertText("stunning autos",false);
the result is
I have this
I select with the mouse the words "performance vehicles"Sports cars are performance vehicles that provide driving satisfaction
(underline means selected)Sports cars are performance vehicles that provide driving satisfaction
I want to replace the selected text with "stunning autos"
so I use
rv->InsertText("stunning autos",false);
the result is
but i would like to haveSports cars are stunning autos that provide driving satisfaction
Hope this is more clearSports cars are stunning autos that provide driving satisfaction
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Code: Select all
int SelStart, SelLength, SelStartNew;
RVGetSelection(RichViewEdit1->TopLevelEditor, SelStart, SelLength);
if (SelLength<0)
SelStart -=SelLength;
RichViewEdit1->InsertText("aaaaaaaaaa", false);
SelStartNew = RVGetLinearCaretPos(RichViewEdit1->TopLevelEditor);
RVSetSelection(RichViewEdit1->TopLevelEditor, SelStart, SelStartNew-SelStart);