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:
@@ -122,6 +122,9 @@ protected:
|
|||||||
WXHWND m_hwndBuddy;
|
WXHWND m_hwndBuddy;
|
||||||
WXFARPROC m_wndProcBuddy;
|
WXFARPROC m_wndProcBuddy;
|
||||||
|
|
||||||
|
// Block text update event after SetValue()
|
||||||
|
bool m_blockEvent;
|
||||||
|
|
||||||
// all existing wxSpinCtrls - this allows to find the one corresponding to
|
// all existing wxSpinCtrls - this allows to find the one corresponding to
|
||||||
// the given buddy window in GetSpinForTextCtrl()
|
// the given buddy window in GetSpinForTextCtrl()
|
||||||
static wxArraySpins ms_allSpins;
|
static wxArraySpins ms_allSpins;
|
||||||
|
@@ -205,7 +205,7 @@ wxSpinCtrl *wxSpinCtrl::GetSpinForTextCtrl(WXHWND hwndBuddy)
|
|||||||
// process a WM_COMMAND generated by the buddy text control
|
// process a WM_COMMAND generated by the buddy text control
|
||||||
bool wxSpinCtrl::ProcessTextCommand(WXWORD cmd, WXWORD WXUNUSED(id))
|
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());
|
wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, GetId());
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
@@ -301,6 +301,8 @@ bool wxSpinCtrl::Create(wxWindow *parent,
|
|||||||
int min, int max, int initial,
|
int min, int max, int initial,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
|
m_blockEvent = false;
|
||||||
|
|
||||||
// this should be in ctor/init function but I don't want to add one to 2.8
|
// 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
|
// to avoid problems with default ctor which can be inlined in the user
|
||||||
// code and so might not get this fix without recompilation
|
// 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)
|
void wxSpinCtrl::SetValue(int val)
|
||||||
{
|
{
|
||||||
|
m_blockEvent = true;
|
||||||
|
|
||||||
wxSpinButton::SetValue(val);
|
wxSpinButton::SetValue(val);
|
||||||
|
|
||||||
// normally setting the value of the spin button is enough as it updates
|
// 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_oldValue = GetValue();
|
||||||
|
|
||||||
|
m_blockEvent = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxSpinCtrl::GetValue() const
|
int wxSpinCtrl::GetValue() const
|
||||||
|
Reference in New Issue
Block a user