[wxPython] OnKillFocus get called twice

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[wxPython] OnKillFocus get called twice

lec-4
wxPython 2.1b1-2
python 1.5.2-2
Red Hat 6.0


I don't understand why the following code gets called twice (wxMessage
pops up twice):

def OnKillFocus(self, event):
    print "OnKill Focus()"
    dlg = wxMessageDialog(self, 'OnKill Focus', '', wxOK)
    dlg.ShowModal()
    dlg.Destroy()

If I don't include the wxMessageDialog, OnKillFocus is called only
once.  Does anybody have any clue to this?

Thanks.



_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [wxPython] OnKillFocus get called twice

Robin Dunn
The wxMessageDialog, by virtue of opening a new window, is causing a new
kill focus event.  Since the focus is still technically on your window
(because you are still in the event handler) the event is sent to the same
window again.  Once the first event handler exits then the next focus event
goes to the new window.

This behaviour is potentially deifferent on each platform, and possibly even
with different window managers on X.

Robin


----- Original Message -----
From: Thomas Lim <[hidden email]>
To: <[hidden email]>
Sent: Sunday, August 01, 1999 9:16 PM
Subject: [wxPython] OnKillFocus get called twice


> wxPython 2.1b1-2
> python 1.5.2-2
> Red Hat 6.0
>
>
> I don't understand why the following code gets called twice (wxMessage
> pops up twice):
>
> def OnKillFocus(self, event):
>     print "OnKill Focus()"
>     dlg = wxMessageDialog(self, 'OnKill Focus', '', wxOK)
>     dlg.ShowModal()
>     dlg.Destroy()
>
> If I don't include the wxMessageDialog, OnKillFocus is called only
> once.  Does anybody have any clue to this?
>
> Thanks.
>
>
>
> _______________________________________________
> wxPython-users maillist  -  [hidden email]
> http://starship.python.net/mailman/listinfo/wxpython-users
>
>


_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users




Loading...