[gnue] r9527 - in trunk/gnue-forms/src: input/displayHandlers uidrivers/wx26/widgets

[email protected]
Newsgroups gmane.comp.cms.gnue.cvs
Message-ID <[email protected]>
Author: johannes
Date: 2007-04-26 07:45:50 -0500 (Thu, 26 Apr 2007)
New Revision: 9527

Modified:
   trunk/gnue-forms/src/input/displayHandlers/Cursor.py
   trunk/gnue-forms/src/uidrivers/wx26/widgets/entry.py
Log:
Cursor position won't be reset in a multiline edit on entering the 
first character after a select-all. SelectAll on wxGTK's multilines 
includes the last character too.

issue164 testing


Modified: trunk/gnue-forms/src/input/displayHandlers/Cursor.py
===================================================================
--- trunk/gnue-forms/src/input/displayHandlers/Cursor.py	2007-04-26 10:51:24 UTC (rev 9526)
+++ trunk/gnue-forms/src/input/displayHandlers/Cursor.py	2007-04-26 12:45:50 UTC (rev 9527)
@@ -323,9 +323,9 @@
             (new_text, start_sel) = self._autocomplete_(new_text, start_sel)
             if len(new_text) > start_sel:
                 new_selection = (start_sel, len(new_text))
+                new_cursor = start_sel
             else:
                 new_selection = (None, None)
-            new_cursor = start_sel
         else:
             new_selection = (None, None)
 

Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/entry.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/entry.py	2007-04-26 10:51:24 UTC (rev 9526)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/entry.py	2007-04-26 12:45:50 UTC (rev 9527)
@@ -517,6 +517,14 @@
             if 'wxGTK' in wx.PlatformInfo:
                 wx.CallAfter(widget.SetSelection, selection1, selection2)
             else:
+                # Workaround for wxMSW: if a multiline text entry has more than
+                # on line of text, SetSelection() does not work properly.
+                if 'wxMSW' in wx.PlatformInfo and selection1 == 0:
+                    if hasattr(widget, 'GetValue'):
+                        val = widget.GetValue()
+                        if len(val) == selection2:
+                            selection1 = selection2 = -1
+
                 widget.SetSelection(selection1, selection2)
 
 
@@ -556,8 +564,7 @@
         widget = self.widgets[index]
 
         if hasattr(widget, 'SelectAll'):
-            # FIXME: issue-145 does not select the last character on wx.GTK
-            widget.SelectAll()
+            widget.SetSelection(-1, -1)
 
 
     # -------------------------------------------------------------------------
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.