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

@@ -115,13 +115,6 @@ void wxFileDirPickerCtrlBase::UpdatePickerFromTextCtrl()
{
wxASSERT(m_text);
if (m_bIgnoreNextTextCtrlUpdate)
{
// ignore this update
m_bIgnoreNextTextCtrlUpdate = false;
return;
}
// remove the eventually present path-separator from the end of the textctrl
// string otherwise we would generate a wxFileDirPickerEvent when changing
// from e.g. /home/user to /home/user/ and we want to avoid it !
@@ -150,11 +143,10 @@ void wxFileDirPickerCtrlBase::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_pickerIface->GetPath());
// Take care to use ChangeValue() here and not SetValue() to avoid
// generating an event that would trigger UpdateTextCtrlFromPicker()
// resulting in infinite recursion.
m_text->ChangeValue(m_pickerIface->GetPath());
}