Lil' bug in SelectionExists method

General TRichView support forum. Please post your questions here
Post Reply
Michael Pro
Posts: 42
Joined: Wed Feb 28, 2007 4:14 am

Lil' bug in SelectionExists method

Post by Michael Pro »

Actually, it's very implicit bug - but I've found it making my own editor and I want to tell how to fix it.
As you can see in sources SelectionExists method calls SelectionExists method with 2 flags, one of which is AllowReset. AllowReset had to be set false, if we're trying to select some part of the text, but if we use Richview method - it's true by default - and it's ok, if we use standard routines.
What I've done? Simply, I needed a method, which would track every change in the editor - and so I've set OnCaretMove event to make some kind of checks (it's related with setting statuses in another panel).
In one of this methods I'm calling RichViewEdit SelectionExists method and this affects the editor's work in a very funny way - it couldn't make selection with Shift+Arrow combination - only making move.
I've solved this problem in the easy way - by calling RvData.SelectionExists(false, true) not Self.SelectionExists method (method of RichViewEdit).
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

I do not recommend working with selection in OnCaretMove, because selection may be incomplete when it is called.
Consider moving all code related to selection change in OnSelect, if possible.
Post Reply