How to use GetSelText without delete selected text ?

General TRichView support forum. Please post your questions here
Post Reply
Benoit B.

How to use GetSelText without delete selected text ?

Post by Benoit B. »

Hi,

all is in the title :P

In fact I use SelectCurrentWord and GetSelText to know the value of the current text. The problem with this method is the word is delete.

thank.
Sergey Tkachenko
Site Admin
Posts: 17566
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

No, GetSelText does not delete the selection.
Something else does it :)
Guest

Post by Guest »

You're right,

But how to have set and get the position of the caret.
In fact, i want to save the position before the SelectCurrentWord and insert it in his old position after the GetSelText.

Thank.
Benoit B.

Post by Benoit B. »

Sorry, I've forgot to write my username :oops:
Sergey Tkachenko
Site Admin
Posts: 17566
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Do you want to insert something before the selection?
Benoit B.

Post by Benoit B. »

Hi,

I want to take the value of the word for a comparaison with database and continu to write.

For exemple, if I do a space in a middle of a word, i would to take his value before do the space and do it after. But if I do SelectCurrentWord, I can go only before or after the word to do the space, and not in the position of the caret before the SelectCurrentWord .

Do you know my problem ?

Thank :wink:
Benoit B.

Post by Benoit B. »

It's good, I've find.


Thank for all. :D
Sergey Tkachenko
Site Admin
Posts: 17566
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

For any case,

If you want to store selection, then change selection, then restore selection, use RVGetSelectionEx and RVSetSelectionEx from RVLinear unit.

But it's not necessary to select word to read its value. For example,
function GetCurrentWord(rve: TCustomRichViewEdit): String; from RVGetText.pas returns the current word (the same Unicode function exists in RVGetTextW.pas)
Post Reply