How can I get the selected text
-
- Posts: 184
- Joined: Wed Jan 18, 2012 6:22 pm
How can I get the selected text
Hi.
How can I do this?
I want to give a double click on the word, making it selected and on the event of double click I want to get the selected word.
I didn't understand how to do that
thanks
How can I do this?
I want to give a double click on the word, making it selected and on the event of double click I want to get the selected word.
I didn't understand how to do that
thanks
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Posts: 184
- Joined: Wed Jan 18, 2012 6:22 pm
-
- Posts: 184
- Joined: Wed Jan 18, 2012 6:22 pm
-
- Posts: 184
- Joined: Wed Jan 18, 2012 6:22 pm
I got the way but I didn't figure out where can I do this:
When I give a double click in a word, it gets selected, after it selected I want to get the text and display it in showmessage.
I put this code on the event doubleclick
ShowMessage( DBSRichViewEdit1.RichViewEdit.GetSelText )
but it is trigger first the word get selected, then, it display an empty value.
How could I work aroung this?
thanks
When I give a double click in a word, it gets selected, after it selected I want to get the text and display it in showmessage.
I put this code on the event doubleclick
ShowMessage( DBSRichViewEdit1.RichViewEdit.GetSelText )
but it is trigger first the word get selected, then, it display an empty value.
How could I work aroung this?
thanks
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Unfortunately, OnDblClick is called when the word is not selected yet, so GetSelText returns empty string.
You can use OnRVMouseDown instead:
You can use OnRVMouseDown instead:
Code: Select all
procedure TForm3.RichViewEdit1RVMouseDown(Sender: TCustomRichView;
Button: TMouseButton; Shift: TShiftState; ItemNo, X, Y: Integer);
begin
if ssDouble in Shift then
Caption := RichViewEdit1.GetSelText;
end;
-
- Posts: 184
- Joined: Wed Jan 18, 2012 6:22 pm
Hi,
It is not working as it should.
Let me explain why I need this:
I work with a component called chant, this component is a voice syntetizer, when the user click on the word, it wants the word can be read by the syntetizer.
When I click on the word, sometimes the word appear and sometimes doesn't. Another thing that I notice, when I click on the second word, the first one disappear.
did you get it?
It is not working as it should.
Let me explain why I need this:
I work with a component called chant, this component is a voice syntetizer, when the user click on the word, it wants the word can be read by the syntetizer.
When I click on the word, sometimes the word appear and sometimes doesn't. Another thing that I notice, when I click on the second word, the first one disappear.
did you get it?
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Sorry, I do not understand.
Do you need to select a word on a single click? You asked about a double click before. Double clicking always selects a clicked word (if you did not exclude rvoDblClickSelectsWord from Options), and OnRVMouseDown with ssDouble in Shift always occurs when the word is selected, so GetSelText returns this word.
If not, please explain how to reproduce this problem, step by step.
What do you mean by appear/disappear?
Do you need to select a word on a single click? You asked about a double click before. Double clicking always selects a clicked word (if you did not exclude rvoDblClickSelectsWord from Options), and OnRVMouseDown with ssDouble in Shift always occurs when the word is selected, so GetSelText returns this word.
If not, please explain how to reproduce this problem, step by step.
What do you mean by appear/disappear?