From 51478cd68dc4b44b7ef0f497de81bff8601b6414 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Sat, 8 Apr 2006 13:00:13 +0000 Subject: [PATCH] allowing the suppression of SetValue event-triggering (needed for composite controls) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38621 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/mac/carbon/textctrl.h | 14 +++++++++++++- src/mac/carbon/combobox.cpp | 1 + src/mac/carbon/textctrl.cpp | 12 ++++++++---- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/include/wx/mac/carbon/textctrl.h b/include/wx/mac/carbon/textctrl.h index a4a6dffdb2..595c3d1f8d 100644 --- a/include/wx/mac/carbon/textctrl.h +++ b/include/wx/mac/carbon/textctrl.h @@ -188,7 +188,7 @@ public: wxMacTextControl * GetPeer() const { return (wxMacTextControl*) m_peer; } - + protected: // common part of all ctors void Init(); @@ -202,6 +202,18 @@ protected: // need to make this public because of the current implementation via callbacks unsigned long m_maxLength; + + bool GetTriggerOnSetValue() const + { + return m_triggerOnSetValue; + } + + void SetTriggerOnSetValue(bool trigger) + { + m_triggerOnSetValue = trigger; + } + + bool m_triggerOnSetValue ; private : wxMenu *m_privateContextMenu; diff --git a/src/mac/carbon/combobox.cpp b/src/mac/carbon/combobox.cpp index 38ff2771cb..35a4521168 100644 --- a/src/mac/carbon/combobox.cpp +++ b/src/mac/carbon/combobox.cpp @@ -68,6 +68,7 @@ public: : wxTextCtrl( cb , 1 ) { m_cb = cb; + SetTriggerOnSetValue( false ); } protected: diff --git a/src/mac/carbon/textctrl.cpp b/src/mac/carbon/textctrl.cpp index 8657a5c792..95729897ce 100644 --- a/src/mac/carbon/textctrl.cpp +++ b/src/mac/carbon/textctrl.cpp @@ -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) -- 2.45.2