X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c0d9b217a7dcec3b322390efcbc5c98615cd3f16..0ec1179b86dac6c87ad9f2cd126f87e92642c62c:/src/univ/textctrl.cpp?ds=sidebyside diff --git a/src/univ/textctrl.cpp b/src/univ/textctrl.cpp index 00e987b800..ee60b694c5 100644 --- a/src/univ/textctrl.cpp +++ b/src/univ/textctrl.cpp @@ -790,21 +790,23 @@ wxTextCtrl::~wxTextCtrl() void wxTextCtrl::DoSetValue(const wxString& value, int flags) { - if ( IsSingleLine() && (value == GetValue()) ) + if ( value != GetValue() ) { - // nothing changed - return; - } + EventsSuppressor noeventsIf(this, !(flags & SetValue_SendEvent)); - Replace(0, GetLastPosition(), value); + Replace(0, GetLastPosition(), value); - if ( IsSingleLine() ) + if ( IsSingleLine() ) + { + SetInsertionPoint(0); + } + } + else // nothing changed { - SetInsertionPoint(0); + // still send event for consistency + if ( flags & SetValue_SendEvent ) + SendTextUpdatedEvent(); } - - if ( flags & SetValue_SendEvent ) - SendTextUpdatedEvent(); } const wxArrayString& wxTextCtrl::GetLines() const @@ -1264,6 +1266,9 @@ void wxTextCtrl::Replace(wxTextPos from, wxTextPos to, const wxString& text) // now call it to do the rest (not related to refreshing) ClearSelection(); + + if ( EventsAllowed() ) + SendTextUpdatedEvent(); } void wxTextCtrl::Remove(wxTextPos from, wxTextPos to)