Dont send spin text update event from SetValue()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53738 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2008-05-24 20:24:58 +00:00
parent f0871806fb
commit ea6cbf486a
2 changed files with 10 additions and 1 deletions

View File

@@ -122,6 +122,9 @@ protected:
WXHWND m_hwndBuddy;
WXFARPROC m_wndProcBuddy;
// Block text update event after SetValue()
bool m_blockEvent;
// all existing wxSpinCtrls - this allows to find the one corresponding to
// the given buddy window in GetSpinForTextCtrl()
static wxArraySpins ms_allSpins;

View File

@@ -205,7 +205,7 @@ wxSpinCtrl *wxSpinCtrl::GetSpinForTextCtrl(WXHWND hwndBuddy)
// process a WM_COMMAND generated by the buddy text control
bool wxSpinCtrl::ProcessTextCommand(WXWORD cmd, WXWORD WXUNUSED(id))
{
if ( cmd == EN_CHANGE )
if ( (cmd == EN_CHANGE) && (!m_blockEvent ))
{
wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, GetId());
event.SetEventObject(this);
@@ -301,6 +301,8 @@ bool wxSpinCtrl::Create(wxWindow *parent,
int min, int max, int initial,
const wxString& name)
{
m_blockEvent = false;
// this should be in ctor/init function but I don't want to add one to 2.8
// to avoid problems with default ctor which can be inlined in the user
// code and so might not get this fix without recompilation
@@ -462,6 +464,8 @@ void wxSpinCtrl::SetValue(const wxString& text)
void wxSpinCtrl::SetValue(int val)
{
m_blockEvent = true;
wxSpinButton::SetValue(val);
// normally setting the value of the spin button is enough as it updates
@@ -477,6 +481,8 @@ void wxSpinCtrl::SetValue(int val)
}
m_oldValue = GetValue();
m_blockEvent = false;
}
int wxSpinCtrl::GetValue() const