Page 1 of 1

Extending selection

Posted: Wed Sep 03, 2008 1:44 pm
by tuukka
Assume that the editor has text/figures consisting of start_item, middle_item1, middle_item2, ..., middle_itemN, end_item. What I need is that whenever any part of any of those item is selected, all of them are selected. (Ideally, I would prefer treating all those items as a single block, but it does not seem to be possible since they are of different styles and they may be separated by line breaks.)

I can do that by calling SetSelectionBounds in OnSelect but that creates another OnSelect event. I can, of course, avoid infinite loop by recognizing the second time that Selection Bounds are already as desired, but it sounds like a kludge.

Posted: Thu Sep 04, 2008 5:02 pm
by Sergey Tkachenko
I can, of course, avoid infinite loop by recognizing the second time that Selection Bounds are already as desired, but it sounds like a kludge.
As for me, it is a normal solution. If selection is not what you need, you change it, OnSelect occurs, but the selection becomes normal, and you do not modify it.
You can also consider using label items instead of text items (they can be selected only as a whole, but they do not support line wrapping).
Or consider using rvprStyleSplitProtect Protection option.