more value updating fixes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48667 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -52,9 +52,9 @@ gtk_value_changed(GtkSpinButton* spinbutton, wxSpinButton* win)
|
|||||||
!event.IsAllowed() )
|
!event.IsAllowed() )
|
||||||
{
|
{
|
||||||
/* program has vetoed */
|
/* program has vetoed */
|
||||||
win->BlockScrollEvent();
|
// this will cause another "value_changed" signal,
|
||||||
|
// but because pos == oldPos nothing will happen
|
||||||
gtk_spin_button_set_value(spinbutton, oldPos);
|
gtk_spin_button_set_value(spinbutton, oldPos);
|
||||||
win->UnblockScrollEvent();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,6 +162,7 @@ void wxSpinButton::SetRange(int minVal, int maxVal)
|
|||||||
|
|
||||||
GtkDisableEvents();
|
GtkDisableEvents();
|
||||||
gtk_spin_button_set_range((GtkSpinButton*)m_widget, minVal, maxVal);
|
gtk_spin_button_set_range((GtkSpinButton*)m_widget, minVal, maxVal);
|
||||||
|
m_pos = int(gtk_spin_button_get_value((GtkSpinButton*)m_widget));
|
||||||
GtkEnableEvents();
|
GtkEnableEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -38,7 +38,7 @@ static void
|
|||||||
gtk_value_changed(GtkSpinButton* spinbutton, wxSpinCtrl* win)
|
gtk_value_changed(GtkSpinButton* spinbutton, wxSpinCtrl* win)
|
||||||
{
|
{
|
||||||
win->m_pos = int(gtk_spin_button_get_value(spinbutton));
|
win->m_pos = int(gtk_spin_button_get_value(spinbutton));
|
||||||
if (!win->m_hasVMT || g_blockEventsOnDrag || win->m_blockScrollEvent)
|
if (!win->m_hasVMT || g_blockEventsOnDrag)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxCommandEvent event( wxEVT_COMMAND_SPINCTRL_UPDATED, win->GetId());
|
wxCommandEvent event( wxEVT_COMMAND_SPINCTRL_UPDATED, win->GetId());
|
||||||
@@ -63,7 +63,7 @@ extern "C" {
|
|||||||
static void
|
static void
|
||||||
gtk_changed(GtkSpinButton* spinbutton, wxSpinCtrl* win)
|
gtk_changed(GtkSpinButton* spinbutton, wxSpinCtrl* win)
|
||||||
{
|
{
|
||||||
if (!win->m_hasVMT || win->m_blockScrollEvent)
|
if (!win->m_hasVMT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, win->GetId() );
|
wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, win->GetId() );
|
||||||
@@ -151,6 +151,7 @@ int wxSpinCtrl::GetValue() const
|
|||||||
|
|
||||||
GtkDisableEvents();
|
GtkDisableEvents();
|
||||||
gtk_spin_button_update( GTK_SPIN_BUTTON(m_widget) );
|
gtk_spin_button_update( GTK_SPIN_BUTTON(m_widget) );
|
||||||
|
m_pos = int(gtk_spin_button_get_value(GTK_SPIN_BUTTON(m_widget)));
|
||||||
GtkEnableEvents();
|
GtkEnableEvents();
|
||||||
|
|
||||||
return m_pos;
|
return m_pos;
|
||||||
@@ -204,6 +205,7 @@ void wxSpinCtrl::SetRange(int minVal, int maxVal)
|
|||||||
|
|
||||||
GtkDisableEvents();
|
GtkDisableEvents();
|
||||||
gtk_spin_button_set_range( GTK_SPIN_BUTTON(m_widget), minVal, maxVal);
|
gtk_spin_button_set_range( GTK_SPIN_BUTTON(m_widget), minVal, maxVal);
|
||||||
|
m_pos = int(gtk_spin_button_get_value(GTK_SPIN_BUTTON(m_widget)));
|
||||||
GtkEnableEvents();
|
GtkEnableEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,7 +214,7 @@ void wxSpinCtrl::GtkDisableEvents() const
|
|||||||
{
|
{
|
||||||
g_signal_handlers_block_by_func( m_widget,
|
g_signal_handlers_block_by_func( m_widget,
|
||||||
(gpointer)gtk_value_changed, (void*) this);
|
(gpointer)gtk_value_changed, (void*) this);
|
||||||
|
|
||||||
g_signal_handlers_block_by_func(m_widget,
|
g_signal_handlers_block_by_func(m_widget,
|
||||||
(gpointer)gtk_changed, (void*) this);
|
(gpointer)gtk_changed, (void*) this);
|
||||||
}
|
}
|
||||||
@@ -221,7 +223,7 @@ void wxSpinCtrl::GtkEnableEvents() const
|
|||||||
{
|
{
|
||||||
g_signal_handlers_unblock_by_func(m_widget,
|
g_signal_handlers_unblock_by_func(m_widget,
|
||||||
(gpointer)gtk_value_changed, (void*) this);
|
(gpointer)gtk_value_changed, (void*) this);
|
||||||
|
|
||||||
g_signal_handlers_unblock_by_func(m_widget,
|
g_signal_handlers_unblock_by_func(m_widget,
|
||||||
(gpointer)gtk_changed, (void*) this);
|
(gpointer)gtk_changed, (void*) this);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user