]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/textentrycmn.cpp
return radio box own help text when origin is Origin_Unknown to make sure GetHelpText...
[wxWidgets.git] / src / common / textentrycmn.cpp
index 7324f6194c8ed8cded8842352b209c8eefb3dfc3..b179499381aabc301d04f1350149301da92d740e 100644 (file)
 wxString wxTextEntryBase::GetRange(long from, long to) const
 {
     wxString sel;
-    if ( from < to )
+    wxString value = GetValue();
+
+    if ( from < to && (long)value.length() >= to )
     {
-        sel = GetValue().substr(from, to - from);
+        sel = value.substr(from, to - from);
     }
 
     return sel;
@@ -60,6 +62,8 @@ void wxTextEntryBase::DoSetValue(const wxString& value, int flags)
 
     SelectAll();
     WriteText(value);
+
+    SetInsertionPoint(0);
 }
 
 void wxTextEntryBase::Replace(long from, long to, const wxString& value)
@@ -69,6 +73,7 @@ void wxTextEntryBase::Replace(long from, long to, const wxString& value)
         Remove(from, to);
     }
 
+    SetInsertionPoint(from);
     WriteText(value);
 }
 
@@ -80,6 +85,14 @@ bool wxTextEntryBase::HasSelection() const
     return from < to;
 }
 
+void wxTextEntryBase::RemoveSelection()
+{
+    long from, to;
+    GetSelection(& from, & to);
+    if (from != -1 && to != -1)
+        Remove(from, to);
+}
+
 wxString wxTextEntryBase::GetStringSelection() const
 {
     long from, to;
@@ -104,8 +117,14 @@ bool wxTextEntryBase::CanPaste() const
     {
 #if wxUSE_CLIPBOARD
         // check if there is any text on the clipboard
-        if ( wxTheClipboard->IsSupported(wxDF_TEXT) )
+        if ( wxTheClipboard->IsSupported(wxDF_TEXT)
+#if wxUSE_UNICODE
+                || wxTheClipboard->IsSupported(wxDF_UNICODETEXT)
+#endif // wxUSE_UNICODE
+           )
+        {
             return true;
+        }
 #endif // wxUSE_CLIPBOARD
     }