class WXDLLIMPEXP_CORE wxColourPickerCtrl : public wxPickerBase
{
public:
- wxColourPickerCtrl() : m_bIgnoreNextTextCtrlUpdate(false) {}
+ wxColourPickerCtrl() {}
virtual ~wxColourPickerCtrl() {}
const wxSize& size = wxDefaultSize, long style = wxCLRP_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxColourPickerCtrlNameStr)
- : m_bIgnoreNextTextCtrlUpdate(false)
{ Create(parent, id, col, pos, size, style, validator, name); }
bool Create(wxWindow *parent, wxWindowID id,
virtual long GetPickerStyle(long style) const
{ return (style & wxCLRP_SHOW_LABEL); }
- // true if the next UpdateTextCtrl() call is to ignore
- bool m_bIgnoreNextTextCtrlUpdate;
-
private:
DECLARE_DYNAMIC_CLASS(wxColourPickerCtrl)
};
class WXDLLIMPEXP_CORE wxFileDirPickerCtrlBase : public wxPickerBase
{
public:
- wxFileDirPickerCtrlBase() : m_bIgnoreNextTextCtrlUpdate(false) {}
+ wxFileDirPickerCtrlBase() {}
protected:
// NB: no default values since this function will never be used
protected:
- // true if the next UpdateTextCtrl() call is to ignore
- bool m_bIgnoreNextTextCtrlUpdate;
-
// m_picker object as wxFileDirPickerWidgetBase interface
wxFileDirPickerWidgetBase *m_pickerIface;
};
{
public:
wxFontPickerCtrl()
- : m_bIgnoreNextTextCtrlUpdate(false),
- m_nMaxPointSize(wxFNTP_MAXPOINT_SIZE)
+ : m_nMaxPointSize(wxFNTP_MAXPOINT_SIZE)
{
}
long style = wxFNTP_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxFontPickerCtrlNameStr)
- : m_bIgnoreNextTextCtrlUpdate(false),
- m_nMaxPointSize(wxFNTP_MAXPOINT_SIZE)
+ : m_nMaxPointSize(wxFNTP_MAXPOINT_SIZE)
{
Create(parent, id, initial, pos, size, style, validator, name);
}
long GetPickerStyle(long style) const
{ return (style & (wxFNTP_FONTDESC_AS_LABEL|wxFNTP_USEFONT_FOR_LABEL)); }
- // true if the next UpdateTextCtrl() call is to ignore
- bool m_bIgnoreNextTextCtrlUpdate;
-
// the maximum pointsize allowed to the user
unsigned int m_nMaxPointSize;
{
wxASSERT(m_text);
- if (m_bIgnoreNextTextCtrlUpdate)
- {
- // ignore this update
- m_bIgnoreNextTextCtrlUpdate = false;
- return;
- }
-
// wxString -> wxColour conversion
wxColour col(m_text->GetValue());
if ( !col.IsOk() )
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());
}
{
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 !
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());
}
{
wxASSERT(m_text);
- if (m_bIgnoreNextTextCtrlUpdate)
- {
- // ignore this update
- m_bIgnoreNextTextCtrlUpdate = false;
- return;
- }
-
// NB: we don't use the wxFont::wxFont(const wxString &) constructor
// since that constructor expects the native font description
// string returned by wxFont::GetNativeFontInfoDesc() and not
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(Font2String(M_PICKER->GetSelectedFont()));
+ // Take care to use ChangeValue() here and not SetValue() to avoid
+ // infinite recursion.
+ m_text->ChangeValue(Font2String(M_PICKER->GetSelectedFont()));
}