]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/textentrycmn.cpp
Don't use "Cancel" button in the about dialog of the listctrl sample.
[wxWidgets.git] / src / common / textentrycmn.cpp
index 5b08496492d14eba7423de13e6a78193c0e93cb9..2ca2077467d17cc4bb96343d85e58d465f3496a2 100644 (file)
@@ -224,12 +224,22 @@ void wxTextEntryBase::AppendText(const wxString& text)
 
 void wxTextEntryBase::DoSetValue(const wxString& value, int flags)
 {
-    EventsSuppressor noeventsIf(this, !(flags & SetValue_SendEvent));
+    if ( value != DoGetValue() )
+    {
+        EventsSuppressor noeventsIf(this, !(flags & SetValue_SendEvent));
 
-    SelectAll();
-    WriteText(value);
+        SelectAll();
+        WriteText(value);
 
-    SetInsertionPoint(0);
+        SetInsertionPoint(0);
+    }
+    else // Same value, no need to do anything.
+    {
+        // Except that we still need to generate the event for consistency with
+        // the normal case when the text does change.
+        if ( flags & SetValue_SendEvent )
+            SendTextUpdatedEvent(GetEditableWindow());
+    }
 }
 
 void wxTextEntryBase::Replace(long from, long to, const wxString& value)