commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r9082 - trunk/gnue-forms/src/uidrivers/wx26/widgets


From: reinhard
Subject: [gnue] r9082 - trunk/gnue-forms/src/uidrivers/wx26/widgets
Date: Tue, 28 Nov 2006 12:28:44 -0600 (CST)

Author: reinhard
Date: 2006-11-28 12:28:43 -0600 (Tue, 28 Nov 2006)
New Revision: 9082

Modified:
   trunk/gnue-forms/src/uidrivers/wx26/widgets/button.py
   trunk/gnue-forms/src/uidrivers/wx26/widgets/entry.py
   trunk/gnue-forms/src/uidrivers/wx26/widgets/form.py
Log:
Do not mess around with the focus while changing a page.


Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/button.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/button.py       2006-11-28 
17:24:58 UTC (rev 9081)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/button.py       2006-11-28 
18:28:43 UTC (rev 9082)
@@ -111,6 +111,11 @@
 
     def __on_set_focus (self, event):
 
+        # This event is blocked while changing a page - the GF moves the focus
+        # to where it wants to have it anyway.
+        if self._uiForm.block_focus_events:
+            return
+
         lookup = event.GetEventObject()
         self._gfObject._event_set_focus(self.widgets.index(lookup))
         event.Skip()

Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/entry.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/entry.py        2006-11-28 
17:24:58 UTC (rev 9081)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/entry.py        2006-11-28 
18:28:43 UTC (rev 9082)
@@ -252,6 +252,11 @@
         if self._uiForm.main_window is None:
             return
 
+        # This event is blocked while changing a page - the GF moves the focus
+        # to where it wants to have it anyway.
+        if self._uiForm.block_focus_events:
+            return
+
         # Let the GF focus follow
         lookup = event.GetEventObject()
         if 'wxMac' in wx.PlatformInfo and self._gfObject.style == 'dropdown':

Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/form.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/form.py 2006-11-28 17:24:58 UTC 
(rev 9081)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/form.py 2006-11-28 18:28:43 UTC 
(rev 9082)
@@ -100,7 +100,10 @@
         self.__status_bar = None
         self.__master_sizer = None
 
+        # Set to True to block focus events
+        self.block_focus_events = False
 
+
     # -------------------------------------------------------------------------
     # Create a new wx frame widget
     # -------------------------------------------------------------------------
@@ -255,7 +258,11 @@
         """
 
         if isinstance (self._container, wx.Notebook):
-            self._container.SetSelection(page_index)
+            self.block_focus_events = True
+            try:
+                self._container.SetSelection(page_index)
+            finally:
+                self.block_focus_events = False
         else:
             # TODO: on wx.MSW the screen does not refresh automatically
             self.main_window.Freeze()
@@ -312,7 +319,8 @@
         # wx sets the focus to nowhere land *after* this code has run, so we
         # must do our focus handling in a CallAfter to get the focus to where
         # we want it.
-        wx.CallAfter(self._form._event_page_changed, event.GetSelection())
+        if not self.block_focus_events:
+            wx.CallAfter(self._form._event_page_changed, event.GetSelection())
         event.Skip()
 
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]