EVT_COMBOBOX handler called twice

Re: [wxPython-users] Re: EVT_COMBOBOX handler called twice

It just depends on when the native control sends the

event/message/callback to wxWidgets.

I was afraid you would say that.

We are developing an application that uses read-only comboboxes to allow the user to filter data that is displayed in a TreeCtrl. The idea was that, when the user changes the combobox selection, the contents of the tree are updated. The data set can be quite large and thus the processing could take several seconds. This would be fine if we only received events when the selection changes but is a problem if the user drags in the drop down list because this generates a stream of events (on GTK).

Does anyone know of a way to ignore the events that are produced by the dragging and only accept the events produced by selecting an item?

regards,

Richard

In your EVT_COMBOBOX handler just set a flag and return. Then add a EVT_IDLE handler that checks that flag and then does the work if it is set and then resets it.

···

Richard.Townsend@edl.uk.eds.com wrote:

> It just depends on when the native control sends the
> event/message/callback to wxWidgets.

I was afraid you would say that.

We are developing an application that uses read-only comboboxes to allow the user to filter data that is displayed in a TreeCtrl. The idea was that, when the user changes the combobox selection, the contents of the tree are updated. The data set can be quite large and thus the processing could take several seconds. This would be fine if we only received events when the selection changes but is a problem if the user drags in the drop down list because this generates a stream of events (on GTK).

Does anyone know of a way to ignore the events that are produced by the dragging and only accept the events produced by selecting an item?

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

If the users haven't used the app yet, you could just force a
select multiple filters -> press refresh button
model so that users just know that setting the filters in the combobox doesn't
do anything until they hit a button. They may forget and be annoyed, but
they'll get used to it, and they'll certainly be less annoyed than the guy
who gets 20 multi-second updates as he scrolls through 20 combobox choices.
:slight_smile:

---Tom

···

On Thursday 30 September 2004 03:46 am, Richard.Townsend@edl.uk.eds.com wrote:

Does anyone know of a way to ignore the events that are produced by the
dragging and only accept the events produced by selecting an item?