dialog damaging frame when moved

(WinXP, wxPython 2.8.10, Python 2.5)

Would there be any obvious reason why a custom dialog would "damage"
the painting of the frame it is in front of when it is moved? I'm
seeing that on one frame: where the dialog is moved it is just white
within the "client area", but not the title bar or menu items. When
the dialog is closed, the entire frame is repainted successfully.

As an unsatisfying fix, I tried binding EVT_MOVE to a handler that
Updated() or Refreshed() the frame, but then the whole frame goes
white all at once.

The damaged frame uses subpanels that themselves set the composite
mode (to support using gradients) and have some DC drawing on them.

Also, only this dialog damages this frame, and the dialog doesn't
damage another frame that is open.

Although I realize this might need a small runnable sample, I have a
feeling that will be hard to reproduce easily and I thought I'd ask if
anything occurs to anyone first.

Thanks,
Che

Hi,

(WinXP, wxPython 2.8.10, Python 2.5)

Would there be any obvious reason why a custom dialog would "damage"
the painting of the frame it is in front of when it is moved? I'm
seeing that on one frame: where the dialog is moved it is just white
within the "client area", but not the title bar or menu items. When
the dialog is closed, the entire frame is repainted successfully.

As an unsatisfying fix, I tried binding EVT_MOVE to a handler that
Updated() or Refreshed() the frame, but then the whole frame goes
white all at once.

The damaged frame uses subpanels that themselves set the composite
mode (to support using gradients) and have some DC drawing on them.

Also, only this dialog damages this frame, and the dialog doesn't
damage another frame that is open.

Although I realize this might need a small runnable sample, I have a
feeling that will be hard to reproduce easily and I thought I'd ask if
anything occurs to anyone first.

If the frame is not repainting it would suggest that something is
blocking the paint events for that window.

Do you use Freeze() or Thaw() anywhere. Such as calling Frame.Freeze()
-> Show Modal Dialog -> Frame.Thaw(). This can cause what your
describing to happen.

Another possibility is showing the modal dialog from within an event
handler that is blocking other paint events from being handled. How
are you showing the dialog?

Cody

···

On Fri, Feb 11, 2011 at 4:12 PM, C M <cmpython@gmail.com> wrote:

Another possibility is showing the modal dialog from within an event
handler that is blocking other paint events from being handled. How
are you showing the dialog?

Hi Cody,

I was using ShowModal(), though not directly within a event handler,
but it was part of a number of steps kicked off by a button press that
ultimately would update the GUI. I put the ShowModal in a CallAfter
and now it is working. Thanks.

-Che

ShowModal implements a nested event loop so it should still allow other events such as the frame's paint to be processed. CallAfter calls are done from within another event handler so if that were not the case then you would have the same problem. It's likely that your ShowModal was blocking a Thaw() or something...

···

On 2/11/11 5:28 PM, C M wrote:

Another possibility is showing the modal dialog from within an event
handler that is blocking other paint events from being handled. How
are you showing the dialog?

Hi Cody,

I was using ShowModal(), though not directly within a event handler,
but it was part of a number of steps kicked off by a button press that
ultimately would update the GUI. I put the ShowModal in a CallAfter
and now it is working. Thanks.

--
Robin Dunn
Software Craftsman

Yes, that was it--I was blocking a Thaw(). It turned out the
CallAfter wasn't going to work for me because then I was not able to
return values to the calling object from the dialog (at least the way
I was doing it) and anyway it was a wrongheaded approach because this
dialog ought to have been called much further "upstream" of the
Freeze()/Thaw() section, since what was being done frozen was
contingent on the answers back from that dialog. I moved it there now
and am avoiding all these issues

Thanks,
Che

···

On Fri, Feb 11, 2011 at 10:09 PM, Robin Dunn <robin@alldunn.com> wrote:

On 2/11/11 5:28 PM, C M wrote:

Another possibility is showing the modal dialog from within an event
handler that is blocking other paint events from being handled. How
are you showing the dialog?

Hi Cody,

I was using ShowModal(), though not directly within a event handler,
but it was part of a number of steps kicked off by a button press that
ultimately would update the GUI. I put the ShowModal in a CallAfter
and now it is working. Thanks.

ShowModal implements a nested event loop so it should still allow other
events such as the frame's paint to be processed. CallAfter calls are done
from within another event handler so if that were not the case then you
would have the same problem. It's likely that your ShowModal was blocking > a Thaw() or something...