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
This commit is contained in:
Stefan Csomor
2006-04-08 13:00:13 +00:00
parent 32efab35c1
commit 51478cd68d
3 changed files with 22 additions and 5 deletions

View File

@@ -203,6 +203,18 @@ protected:
// need to make this public because of the current implementation via callbacks // need to make this public because of the current implementation via callbacks
unsigned long m_maxLength; unsigned long m_maxLength;
bool GetTriggerOnSetValue() const
{
return m_triggerOnSetValue;
}
void SetTriggerOnSetValue(bool trigger)
{
m_triggerOnSetValue = trigger;
}
bool m_triggerOnSetValue ;
private : private :
wxMenu *m_privateContextMenu; wxMenu *m_privateContextMenu;

View File

@@ -68,6 +68,7 @@ public:
: wxTextCtrl( cb , 1 ) : wxTextCtrl( cb , 1 )
{ {
m_cb = cb; m_cb = cb;
SetTriggerOnSetValue( false );
} }
protected: protected:

View File

@@ -435,6 +435,7 @@ void wxTextCtrl::Init()
m_maxLength = 0; m_maxLength = 0;
m_privateContextMenu = NULL; m_privateContextMenu = NULL;
m_triggerOnSetValue = true ;
} }
wxTextCtrl::~wxTextCtrl() wxTextCtrl::~wxTextCtrl()
@@ -545,10 +546,13 @@ void wxTextCtrl::SetValue(const wxString& str)
GetPeer()->SetStringValue( str ) ; GetPeer()->SetStringValue( str ) ;
if ( m_triggerOnSetValue )
{
wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, m_windowId ); wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, m_windowId );
event.SetString( GetValue() ); event.SetString( GetValue() );
event.SetEventObject( this ); event.SetEventObject( this );
GetEventHandler()->ProcessEvent( event ); GetEventHandler()->ProcessEvent( event );
}
} }
void wxTextCtrl::SetMaxLength(unsigned long len) void wxTextCtrl::SetMaxLength(unsigned long len)