Remove workarounds for wxTextCtrl::SetValue() events in pickers code.

Simply use ChangeValue() instead of SetValue() to avoid the unwanted events
instead of using guard variables.

No real changes but the code is simpler and shorter now.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72454 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-09-09 13:35:57 +00:00
parent 4a2c28bf68
commit 44b7211689
6 changed files with 14 additions and 52 deletions

View File

@@ -96,13 +96,6 @@ void wxColourPickerCtrl::UpdatePickerFromTextCtrl()
{
wxASSERT(m_text);
if (m_bIgnoreNextTextCtrlUpdate)
{
// ignore this update
m_bIgnoreNextTextCtrlUpdate = false;
return;
}
// wxString -> wxColour conversion
wxColour col(m_text->GetValue());
if ( !col.IsOk() )
@@ -123,11 +116,9 @@ void wxColourPickerCtrl::UpdateTextCtrlFromPicker()
if (!m_text)
return; // no textctrl to update
// NOTE: this SetValue() will generate an unwanted wxEVT_COMMAND_TEXT_UPDATED
// which will trigger a unneeded UpdateFromTextCtrl(); thus before using
// SetValue() we set the m_bIgnoreNextTextCtrlUpdate flag...
m_bIgnoreNextTextCtrlUpdate = true;
m_text->SetValue(M_PICKER->GetColour().GetAsString());
// Take care to use ChangeValue() here and not SetValue() to avoid
// infinite recursion.
m_text->ChangeValue(M_PICKER->GetColour().GetAsString());
}