]> git.saurik.com Git - wxWidgets.git/commitdiff
position the insertion point to the start, not end, of the selection for compatibilit...
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 22 Sep 2008 16:15:35 +0000 (16:15 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 22 Sep 2008 16:15:35 +0000 (16:15 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55799 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

interface/wx/textctrl.h
src/gtk/textentry.cpp

index 3f68fa92f3f6fb72889e065d635df3f3b670bc0c..568edff93007f91fdaec7b5633dc63dee2e388ee 100644 (file)
@@ -1435,6 +1435,9 @@ public:
 
         If both parameters are equal to -1 all text in the control is selected.
 
+        Notice that the insertion point will be moved to @a from by this
+        function.
+
         @param from
             The first position.
         @param to
index a84c0e691ef83f0a79c3387009a321aca03774e9..99d0f129435aaf986dec8f978960c85a1d72207d 100644 (file)
@@ -193,7 +193,10 @@ void wxTextEntry::SetSelection(long from, long to)
     if ( from == -1 && to == -1 )
         from = 0;
 
-    gtk_editable_select_region(GetEditable(), from, to);
+    // for compatibility with MSW, exchange from and to parameters so that the
+    // insertion point is set to the start of the selection and not its end as
+    // GTK+ does by default
+    gtk_editable_select_region(GetEditable(), to, from);
 }
 
 void wxTextEntry::GetSelection(long *from, long *to) const