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

[email protected]
Newsgroups gmane.comp.cms.gnue.cvs
Message-ID <[email protected]>
Author: reinhard
Date: 2007-07-30 12:41:13 -0500 (Mon, 30 Jul 2007)
New Revision: 9768

Modified:
   trunk/gnue-forms/src/uidrivers/wx26/widgets/entry.py
Log:
Some fixes for wx2.8 compatibility.


Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/entry.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/entry.py	2007-07-24 22:42:50 UTC (rev 9767)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/entry.py	2007-07-30 17:41:13 UTC (rev 9768)
@@ -292,6 +292,11 @@
 
     def __on_item_selected(self, event):
 
+        # In wx2.8, the widget may not yet have the focus. However, we must
+        # make sure the event arrives at the correct widget.
+        widget = event.GetEventObject()
+        self._gfObject._event_set_focus(self.widgets.index(widget))
+
         self._request('REPLACEVALUE', index=event.GetSelection(),
                 text=event.GetString())
 
@@ -299,7 +304,12 @@
 
     def __on_text_changed(self, event):
 
+        # In wx2.8, the widget may not yet have the focus. However, we must
+        # make sure the event arrives at the correct widget.
         widget = event.GetEventObject()
+        self._gfObject._event_set_focus(self.widgets.index(widget))
+
+        widget = event.GetEventObject()
         cursor = widget.GetInsertionPoint()
 
         self._request('REPLACEVALUE', text=widget.GetValue(), position=cursor)
@@ -308,6 +318,11 @@
 
     def __on_gtk_text_changed(self, event):
 
+        # In wx2.8, the widget may not yet have the focus. However, we must
+        # make sure the event arrives at the correct widget.
+        widget = event.GetEventObject()
+        self._gfObject._event_set_focus(self.widgets.index(widget))
+
         # FIXME: workaround for issue-144.  Setting a selection within an
         # EVT_TEXT event does not work on wx.GTK, so we defer the replace-event
         # to the next idle loop.
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.