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

[email protected]
Newsgroups gmane.comp.cms.gnue.cvs
Message-ID <[email protected]>
Author: johannes
Date: 2008-06-10 09:52:31 -0500 (Tue, 10 Jun 2008)
New Revision: 9878

Modified:
   trunk/gnue-forms/src/uidrivers/wx26/widgets/entry.py
Log:
Enter of numeric keypad behaves in the same way as the normal enter key


Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/entry.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/entry.py	2008-06-09 11:09:17 UTC (rev 9877)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/entry.py	2008-06-10 14:52:31 UTC (rev 9878)
@@ -292,11 +292,6 @@
 
     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())
 
@@ -304,12 +299,7 @@
 
     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)
@@ -324,23 +314,11 @@
         # 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.
-        widget = event.GetEventObject()
-        index = self.widgets.index(widget)
-        wx.CallAfter(self.__deferred_gtk_text_changed, text=event.GetString(),
-                index=index)
+        wx.CallAfter(self._request, 'REPLACEVALUE', text=event.GetString())
 
         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):
@@ -365,6 +343,10 @@
 
         keycode = event.GetKeyCode()
 
+        # Treat enter of the numeric keypad the same way as normal enter key
+        if keycode == wx.WXK_NUMPAD_ENTER:
+            keycode = wx.WXK_RETURN
+
         is_cmd = keycode in [wx.WXK_TAB, wx.WXK_RETURN, wx.WXK_UP, wx.WXK_DOWN]
         command = None
 
@@ -405,6 +387,10 @@
             self._uiForm.main_window.Close()
             return
 
+        # Treat enter of the numeric keypad the same way as normal enter key
+        if keycode == wx.WXK_NUMPAD_ENTER:
+            keycode = wx.WXK_RETURN
+
         allowed = [wx.WXK_RETURN, wx.WXK_TAB]
 
         if keycode in allowed:
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.