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

[email protected]
Newsgroups gmane.comp.cms.gnue.cvs
Message-ID <[email protected]>
Author: reinhard
Date: 2009-03-17 17:11:33 -0500 (Tue, 17 Mar 2009)
New Revision: 9912

Modified:
   trunk/gnue-forms/src/uidrivers/wx26/widgets/entry.py
Log:
Workaround for a bug in wxGTK 2.8: ComboBox does not receive EVT_SET_FOCUS when
the dropdown button is clicked.


Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/entry.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/entry.py	2009-02-24 12:54:22 UTC (rev 9911)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/entry.py	2009-03-17 22:11:33 UTC (rev 9912)
@@ -177,6 +177,11 @@
         item.Bind(wx.EVT_SET_FOCUS, self.__on_set_focus)
         item.Bind(wx.EVT_KEY_DOWN, self.__on_combo_keydown)
 
+        # Workaround for a bug in wxGTK 2.8 (tested with 2.8.7.1) - ComboBox
+        # does not receive EVT_SET_FOCUS when the dropdown button is clicked.
+        if 'wxGTK' in wx.PlatformInfo:
+            item.Bind(wx.EVT_COMBOBOX, self.__on_combobox)
+
         if 'wxMSW' in wx.PlatformInfo:
             item.Bind(wx.EVT_MOUSEWHEEL, self.__on_cbx_wheel)
 
@@ -339,6 +344,18 @@
 
     # -------------------------------------------------------------------------
 
+    def __on_combobox(self, event):
+
+        # Workaround for a bug in wxGTK 2.8 (tested with 2.8.7.1) - ComboBox
+        # does not receive EVT_SET_FOCUS when the dropdown button is clicked.
+        combobox = event.GetEventObject()
+        combobox.SetFocus()
+        wx.CallAfter(combobox.SetMark, 0, -1)
+        event.Skip()
+
+
+    # -------------------------------------------------------------------------
+
     def __on_keypress(self, event):
 
         keycode = event.GetKeyCode()
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.