commit-gnue
[Top][All Lists]
Advanced

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

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


From: johannes
Subject: [gnue] r8211 - trunk/gnue-forms/src/uidrivers/wx26/widgets
Date: Tue, 7 Mar 2006 06:44:13 -0600 (CST)

Author: johannes
Date: 2006-03-07 06:44:13 -0600 (Tue, 07 Mar 2006)
New Revision: 8211

Modified:
   trunk/gnue-forms/src/uidrivers/wx26/widgets/_base.py
Log:
Don't call SetFocus multiple times for the same controls, which fixes 
the dropdown-click on wx.MSW. Use a better way to set the values of 
dropdowns, which keeps the selected value of the Choice-Control in sync 
on Mac OS X.


Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/_base.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/_base.py        2006-03-07 
00:04:31 UTC (rev 8210)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/_base.py        2006-03-07 
12:44:13 UTC (rev 8211)
@@ -147,19 +147,25 @@
     in gnue.conf.
     """
 
-    widget = self.widgets [index]
+    widget  = self.widgets [index]
+    current = widget.FindFocus ()
 
     if isinstance (widget, wx.ComboBox) and 'wxMac' in wx.PlatformInfo:
-      widget._entry.SetFocus ()
+      item = widget._entry
     else:
-      widget.SetFocus ()
+      item = widget
 
+    # Only change the focus if necessary
+    if current != item:
+      item.SetFocus ()
 
+
   # ---------------------------------------------------------------------------
   # On lose of the focus we un-select ComboBox-Entries
   # ---------------------------------------------------------------------------
 
   def loseFocus (self):
+
     pass
 
 
@@ -189,7 +195,12 @@
           widget.SetStringSelection (value, True)
 
       else:
-        widget.SetValue (value)
+        if isinstance (widget, wx.ComboBox):
+          # We use SetStringSelection to keep the selected index in sync with
+          # the string value (e.g. in Choice-Controls on OS X)
+          widget.SetStringSelection (value)
+        else:
+          widget.SetValue (value)
 
       widget.Enable (enabled)
 





reply via email to

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