any way to find visibility of a widget ?

Dear all,

we are using wxPython in the GNUmed medical practice
application. To keep the UI responsive we are updating the UI
from the database in two steps:

1) when a change in the backend occurs it notifies the
   middleware which evicts its cache and notifies the UI

2) the UI thereupon schedules a repopulation of it's fields
   for the next EVT_PAINT

Now, for widgets that are not currently visible this is fine -
whenever they are raised into visibility they and only they
will repopulate themselves. However, widgets that are already
visible when the backend change gets announced to the UI will
not be repopulated immediately (because there is no EVT_PAINT
involved that could trigger the scheduled repopulation). We
have experimented with

wxPaintDC.GetClippingBox()
GetUpdateRegion()
GetUpdateRegion().IsEmpty()
IsShown()

neither of which holds any information on *visibility*.

Is there any way to get at the state of visibility for any
given widget ? Something like self.IsVisible(). Or will we
have to track visibility ourselves ? Or is the solution to
just issue an artifical EVT_PAINT ? (any caveats with that ?)

Any help appreciated. Code available if needed.

Karsten

···

--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346

Dear all,

we are using wxPython in the GNUmed medical practice
application. To keep the UI responsive we are updating the UI
from the database in two steps:

1) when a change in the backend occurs it notifies the
   middleware which evicts its cache and notifies the UI

2) the UI thereupon schedules a repopulation of it's fields
   for the next EVT_PAINT

Now, for widgets that are not currently visible this is fine -
whenever they are raised into visibility they and only they
will repopulate themselves. However, widgets that are already
visible when the backend change gets announced to the UI will
not be repopulated immediately (because there is no EVT_PAINT
involved that could trigger the scheduled repopulation). We
have experimented with

wxPaintDC.GetClippingBox()
GetUpdateRegion()
GetUpdateRegion().IsEmpty()
IsShown()

neither of which holds any information on *visibility*.

Is there any way to get at the state of visibility for any
given widget ? Something like self.IsVisible(). Or will we
have to track visibility ourselves ? Or is the solution to
just issue an artifical EVT_PAINT ? (any caveats with that ?)

I'm not sure exactly what your situation is, but calling Refresh() on
your top level window should do what you want.

···

On 5/15/05, Karsten Hilbert <Karsten.Hilbert@gmx.net> wrote:

Any help appreciated. Code available if needed.

Karsten
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346

Chris Mellon wrote:

Is there any way to get at the state of visibility for any
given widget ? Something like self.IsVisible(). Or will we
have to track visibility ourselves ? Or is the solution to
just issue an artifical EVT_PAINT ? (any caveats with that ?)

I'm not sure exactly what your situation is, but calling Refresh() on
your top level window should do what you want.

And would probably be the proper way to do it as well, or perhaps only to those windows that are sensitive to the updates from the DB. The refresh will propogate down to child windows but should be ignored for those that are not visible. (BTW in one of the later 2.5 versions this propogation was broken on Windows, but it is fixed in 2.6)

···

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