]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/textctrl.cpp
[ 1473731 ] 'wxColourBase and wxString <-> wxColour implementation' with minor modifi...
[wxWidgets.git] / src / mac / carbon / textctrl.cpp
index 8657a5c7920682da196d5e127267da35678dc08e..36a9d22ced6ad7b2a3092fdb5c97196787bcfac8 100644 (file)
@@ -435,6 +435,7 @@ void wxTextCtrl::Init()
 
     m_maxLength = 0;
     m_privateContextMenu = NULL;
+    m_triggerOnSetValue = true ;
 }
 
 wxTextCtrl::~wxTextCtrl()
@@ -545,10 +546,13 @@ void wxTextCtrl::SetValue(const wxString& str)
 
     GetPeer()->SetStringValue( str ) ;
 
-    wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, m_windowId );
-    event.SetString( GetValue() );
-    event.SetEventObject( this );
-    GetEventHandler()->ProcessEvent( event );
+    if ( m_triggerOnSetValue )
+    {
+        wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, m_windowId );
+        event.SetString( GetValue() );
+        event.SetEventObject( this );
+        GetEventHandler()->ProcessEvent( event );
+    }
 }
 
 void wxTextCtrl::SetMaxLength(unsigned long len)
@@ -1570,9 +1574,11 @@ wxString wxMacMLTEControl::GetStringValue() const
                 (((UniChar*)*theText)[actualSize]) = 0 ;
                 wxMBConvUTF16 converter ;
                 size_t noChars = converter.MB2WC( NULL , (const char*)*theText , 0 ) ;
+                               wxASSERT_MSG( noChars != wxCONV_FAILED, _T("Unable to count the number of characters in this string!") );
                 ptr = new wxChar[noChars + 1] ;
 
-                noChars = converter.MB2WC( ptr , (const char*)*theText , noChars ) ;
+                noChars = converter.MB2WC( ptr , (const char*)*theText , noChars + 1 ) ;
+                               wxASSERT_MSG( noChars != wxCONV_FAILED, _T("Conversion of string failed!") );
                 ptr[noChars] = 0 ;
                 HUnlock( theText ) ;
 #endif