Hi,
I've created a listbox component which inherits from UltraListView (set with listbox properties).
In my class I've overrided many events such as ItemSelectionChanging, ItemCheckStateChanging etc.. in order to achieve my goals.
However I have a problem, and let's take this simple example: when a new Item is active, which means I've clicked on it, I change his color and modify its checkstate.
When my listbox gets focus and when I click on an item, the first Item of the list is processed too, because it seems to be active since the beginning my listbox has focus...After that there is no other problem of this kind, this just happens for the first selection!
Any idea to prevent the first Item of the listview from being Active ?
Or any idea of the problem if I'm wrong ?
The control automatically activates the first visible item when the control is entered, in emulation of Windows Explorer. You can prevent this by overriding OnEnter, setting a flag before the base implementation is called, and clearing it thereafter. Then, in OnItemActivating, if that flag is true, set the Cancel property of the event arguments to true.
Thank you for the trick, do you have any idea concerning the other question? With the property set to mark selected items ?