From: Robert Roebling Date: Fri, 23 May 2008 19:40:28 +0000 (+0000) Subject: Simplify SetValue() with empty string X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/d1263a3992c1ccf03c98d99bbfce9849196caf6f Simplify SetValue() with empty string git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53728 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index 3dc367da3e..340ab8038f 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -955,6 +955,19 @@ void wxTextCtrl::DoSetValue( const wxString &value, int flags ) return; } + if (value.IsEmpty()) + { + if ( !(flags & SetValue_SendEvent) ) + EnableTextChangedEvents(false); + + gtk_text_buffer_set_text( m_buffer, "", 0 ); + + if ( !(flags & SetValue_SendEvent) ) + EnableTextChangedEvents(true); + + return; + } + wxFontEncoding enc = m_defaultStyle.HasFont() ? m_defaultStyle.GetFont().GetEncoding() : wxFONTENCODING_SYSTEM;