Custom Event To VISIBLE widgets???

Hi,

Is there a way to control event propogation so a custom event is only
delivered to visible widgets that are ? I've got an application with
a few thousand widgets burried through a few pages of nested
wx.Notebook's. Sending an update event to all the widgets is too
processor intensive. Calling Refresh() on the top level and have all
the custom widgets bound to EVT_PAINT works but is not optimal. It
seems like one should be able to hook into the same machinery that
propogates an EVT_PAINT event but I haven't found it yet. Any ideas?

Note, calling isVisible() or isShownOnScreen() on a widget on a page
of a notebook that is not visible always returns true.

Thanks!

Matt Newcomb

It might be interesting to mention that this application controls

a hot water drill in Antarctica at the south pole. wxPython pushing
around 4.6 million watts ( in the form of hot water )!

Matt Newcomb wrote:

Is there a way to control event propogation so a custom event is only
delivered to visible widgets that are ? I've got an application with
a few thousand widgets burried through a few pages of nested
wx.Notebook's. Sending an update event to all the widgets is too
processor intensive. Calling Refresh() on the top level and have all
the custom widgets bound to EVT_PAINT works but is not optimal. It
seems like one should be able to hook into the same machinery that
propogates an EVT_PAINT event but I haven't found it yet. Any ideas?

I think I would take a different approach to this and use some higher level messages to indicate when groups of widgets should or shouldn't listen for update messages. For example, you could use wx.lib.pubsub and all the widgets would subscribe to a "page X is visible" message and a "page X is hidden" message. When the notebook sends the EVT_NOTEBOOK_PAGE_CHANGED event you can send the hidden message for the previously visible page, and the visible message for the newly visible page. Then anything that subscribes to those messages can then subscribe or unsubscribe to the main update message. The end result would be that only those items in the visible notebook pages will be currently subscribed to the main update message, and the place in the code that wants to send that message doesn't know (or care) which widgets are subscribed, it just blindly sends the message and lets pubsub worry about delivering it.

Note, calling isVisible() or isShownOnScreen() on a widget on a page
of a notebook that is not visible always returns true.

IIRC there was a change in 2.9 to make this work more like what is expected for items in notebooks, so it will eventually be available.

ยทยทยท

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