[wxPython] Bug: Eventhandling hangs under MSW and ShowModal

Ok I am trying to prevent a listview from letting the user change
the selection. My approach is to Select the old Item with wxCallAfter
as suggested by Robin Dunn after onSelect/onDeSelect Events are done.

My Problem is that the eventhandling hangs under MSW under special
Circumstances until the mouse is moved over the Window.

Below a Script to reproduce the bug.

Change the selection of an Item by clicking the left mouse button,
but dont move the mouse.

Now the MessageDialog pops up. Press Escape to close it,
and you see that the after-function is called exactly when you
move the mouse over the Windows, but not earlier.

Well, I can't seem to duplicate it. (In my current 2.3.3pre workspace) I
can't select with the mouse and then *not* move the mouse afterwards, so I
always get this:

ONSELECT
ONDESELECT
ONSELECT
CALLAFTER

The same happens if I use only the keyboard...

Anyway, I would guess that what you are seeing is that the message posted by
the wxWakeUpIdle burried in wxCallAfter is getting eaten by the modal loop
used by the dialog, or perhaps the dialog cleanup. Maybe if you showed the
dialog from another wxCallAfter handler???

Hold on... Okay, I was able to duplicate your problem if I used
"app=App(0)" so the stdio window was not shown. Printing to that window
caused additional events to happen so the callafter was called... Switching
things around like this should take care of it for you:

    def onDeSelect(self,event):
        print "ONDESELECT"
        wxCallAfter(self.after)

    def after(self):
        m=wxMessageDialog(parent=self, message="Test", caption="Cap",
style=wxOK|wxCANCEL)
        m.ShowModal()
        m.Destroy()
        print "CALLAFTER"

···

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

> Ok I am trying to prevent a listview from letting the user change
> the selection. My approach is to Select the old Item with wxCallAfter
> as suggested by Robin Dunn after onSelect/onDeSelect Events are done.
>
> My Problem is that the eventhandling hangs under MSW under special
> Circumstances until the mouse is moved over the Window.
>
> Below a Script to reproduce the bug.
>
> Change the selection of an Item by clicking the left mouse button,
> but dont move the mouse.
>
> Now the MessageDialog pops up. Press Escape to close it,
> and you see that the after-function is called exactly when you
> move the mouse over the Windows, but not earlier.

Well, I can't seem to duplicate it. (In my current 2.3.3pre workspace) I
can't select with the mouse and then *not* move the mouse afterwards, so I
always get this:

ONSELECT
ONDESELECT
ONSELECT
CALLAFTER

The same happens if I use only the keyboard...

Anyway, I would guess that what you are seeing is that the message posted by
the wxWakeUpIdle burried in wxCallAfter is getting eaten by the modal loop
used by the dialog, or perhaps the dialog cleanup. Maybe if you showed the
dialog from another wxCallAfter handler???

Hold on... Okay, I was able to duplicate your problem if I used
"app=App(0)" so the stdio window was not shown. Printing to that window
caused additional events to happen so the callafter was called... Switching
things around like this should take care of it for you:

    def onDeSelect(self,event):
        print "ONDESELECT"
        wxCallAfter(self.after)

    def after(self):
        m=wxMessageDialog(parent=self, message="Test", caption="Cap",
style=wxOK|wxCANCEL)
        m.ShowModal()
        m.Destroy()
        print "CALLAFTER"

- So well is it a bug?
- Would it be possible to get it fixed until the next release?
- Is there a way to give the eventhandling system a "kick"
  e.g. from a timer, telling the wx-system explicitly to process
  the queue?

Greetings, and thank you very much for your answers.

Best regards, Andre'

···

On Mon, 29 Jul 2002 11:39:14 -0700 "Robin Dunn" <robin@alldunn.com> wrote:

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

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users