On May 7, 2006, at 7:31 PM, [EMAIL PROTECTED] wrote:
I noticed that when I change an item in a listbox, the change event is
getting fired multiple times because I am redrawing the list,
sorting, etc. I want
to make it sort without firing the change event.
Seth and others had an idea for making a popup not fire the change
event when
it was changed from code rather than manually by the user. The idea
was to
make a custom popup class with a "change_from_code" boolean. Then
there is a
single method "setIndex( j )" which simply sets the list index. And
this scheme
works. And in the open even there is initialization of that flag to
be true
by default.
However, I would like to do the sort of a listbox in the same sort
of way. I
can't just sent an index value in this case. Is there a way to
adapt this
idea?
Sure. Add a property BlockChange as Boolean. Then implement the
Change event handler of your Listbox subclass as follows.
Sub Change()
If BlockChange then
Return
End if
Change
End Sub
I'm a little surprised that sorting the Listbox would call the Change
event handler; are you sorting using Listbox.Sort?
Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>