Author: reinhard
Date: 2010-01-28 04:08:47 -0600 (Thu, 28 Jan 2010)
New Revision: 10148

Modified:
   trunk/gnue-forms/src/uidrivers/wx/widgets/form.py
Log:
Fix for focus not returning to the right control after a message box was shown
under Windows.


Modified: trunk/gnue-forms/src/uidrivers/wx/widgets/form.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx/widgets/form.py   2010-01-24 11:13:28 UTC 
(rev 10147)
+++ trunk/gnue-forms/src/uidrivers/wx/widgets/form.py   2010-01-28 10:08:47 UTC 
(rev 10148)
@@ -465,6 +465,8 @@
             the No-button was pressed or None if the Cancel-button was pressed.
         """
 
+        focus = wx.Window.FindFocus()
+
         mbRec  = _MBOX_KIND.get(kind.lower())
         flags  = mbRec['type'] | mbRec['buttons']
         if cancel:
@@ -477,6 +479,13 @@
         finally:
             dialog.Destroy()
 
+        # FIXME: Under Windows, the focus returns to the Frame instead of the
+        # actual widget after the MessageDialog has been closed. I wasn't able
+        # to reproduce this outside GNUe, and I have no idea why this happens.
+        # Anyway, we reset the focus to where it was before just to play safe.
+        if wx.Platform == '__WXMSW__':
+            focus.SetFocus()
+
         return _RESPONSE[result]
 
     # -------------------------------------------------------------------------



_______________________________________________
commit-gnue mailing list
commit-gnue@gnu.org
http://lists.gnu.org/mailman/listinfo/commit-gnue

Reply via email to