Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
460
Prevent first Item in list from becoming active
posted

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 ?

 

Parents
  • 69832
    Suggested Answer
    Offline posted

    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.

Reply Children