[gnue] r9769 - 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 13:01:26 -0500 (Mon, 30 Jul 2007)
New Revision: 9769

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


Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/entry.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/entry.py	2007-07-30 17:41:13 UTC (rev 9768)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/entry.py	2007-07-30 18:01:26 UTC (rev 9769)
@@ -318,22 +318,29 @@
 
     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.
         # We do not pass the position here because it's not correct - the
         # cursor position is not yet updated at the time this is called. So we
         # let the GF* logic figure out the new cursor position.
-        wx.CallAfter(self._request, 'REPLACEVALUE', text=event.GetString())
+        widget = event.GetEventObject()
+        index = self.widgets.index(widget)
+        wx.CallAfter(self.__deferred_gtk_text_changed, text=event.GetString(),
+                index=index)
 
         event.Skip()
 
+    # -------------------------------------------------------------------------
 
+    def __deferred_gtk_text_changed(self, text, index):
+
+        # In wx2.8, the widget may not yet have the focus. However, we must
+        # make sure the event arrives at the correct widget.
+        self._gfObject._event_set_focus(index)
+
+        self._request('REPLACEVALUE', text=text)
+
     # -------------------------------------------------------------------------
 
     def __on_key_down(self, event):
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.