]> git.saurik.com Git - wxWidgets.git/commitdiff
reset the dirty flag before generating the event from SetValue() in case the text...
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 16 May 2006 23:53:55 +0000 (23:53 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 16 May 2006 23:53:55 +0000 (23:53 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39170 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/textctrl.cpp

index 4230d680339fbdd51111b553ece30ba79f3eba68..d893afe8d55fb89d94896e17ec34b17c7bc9195b 100644 (file)
@@ -791,20 +791,24 @@ void wxTextCtrl::SetValue(const wxString& value)
     {
         DoWriteText(value, false /* not selection only */);
 
+        // mark the control as being not dirty - we changed its text, not the
+        // user
+        DiscardEdits();
+
         // for compatibility, don't move the cursor when doing SetValue()
         SetInsertionPoint(0);
     }
     else // same text
     {
+        // still reset the modified flag even if the value didn't really change
+        // because now it comes from the program and not the user (and do it
+        // before generating the event so that the event handler could get the
+        // expected value from IsModified())
+        DiscardEdits();
+
         // still send an event for consistency
         SendUpdateEvent();
     }
-
-    // we should reset the modified flag even if the value didn't really change
-
-    // mark the control as being not dirty - we changed its text, not the
-    // user
-    DiscardEdits();
 }
 
 #if wxUSE_RICHEDIT && (!wxUSE_UNICODE || wxUSE_UNICODE_MSLU)