Problem with selecting in OnEnter event

General TRichView support forum. Please post your questions here
Post Reply
DickBryant
Posts: 148
Joined: Wed Dec 07, 2005 2:02 pm
Contact:

Problem with selecting in OnEnter event

Post by DickBryant »

Hi Sergey,

I'm using the following code to select certain text if it exists upon entering an rve:

AQDMemo.Format;
if ((GetAllText(AQDMemo) = 'Insert your new answer text here')
or (Pos('dummy answer', GetAllText(AQDMemo)) > 0)
or (GetAllText(AQDMemo) = '')) then
begin
AQDMemo.SelectAll;
AQDMemo.ApplyTextStyle(2);
end;

This works fine if the rve is entered by tabbing. But if I click with the mouse to enter the rve I can see that the text is indeed selected as long as I hold down the mouse button, but as soon as I let go, the text deselects.

Any suggestions on getting the selection to 'stick'?

Thanks!
Post Reply