From 6027b33b1500aabb74419090cd73a96f1211ece2 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Tue, 10 Jul 2007 12:00:48 +0000 Subject: [PATCH] Block all events in wxSpinButton::SetValue etc. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@47293 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/spinbutt.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/gtk/spinbutt.cpp b/src/gtk/spinbutt.cpp index 25c26b63a0..c1888c13de 100644 --- a/src/gtk/spinbutt.cpp +++ b/src/gtk/spinbutt.cpp @@ -150,22 +150,34 @@ int wxSpinButton::GetValue() const return m_pos; } +static void wxSpinButton_GtkDisableEvents( const wxSpinButton *spinctrl ) +{ + g_signal_handlers_block_by_func( spinctrl->m_widget, + (gpointer)gtk_value_changed, (void*) spinctrl ); +} + +static void wxSpinButton_GtkEnableEvents( const wxSpinButton *spinctrl ) +{ + g_signal_handlers_unblock_by_func( spinctrl->m_widget, + (gpointer)gtk_value_changed, (void*) spinctrl ); +} + void wxSpinButton::SetValue( int value ) { wxCHECK_RET( (m_widget != NULL), wxT("invalid spin button") ); - BlockScrollEvent(); + wxSpinButton_GtkDisableEvents( this ); gtk_spin_button_set_value((GtkSpinButton*)m_widget, value); - UnblockScrollEvent(); + wxSpinButton_GtkEnableEvents( this ); } void wxSpinButton::SetRange(int minVal, int maxVal) { wxCHECK_RET( (m_widget != NULL), wxT("invalid spin button") ); - BlockScrollEvent(); + wxSpinButton_GtkDisableEvents( this ); gtk_spin_button_set_range((GtkSpinButton*)m_widget, minVal, maxVal); - UnblockScrollEvent(); + wxSpinButton_GtkEnableEvents( this ); } void wxSpinButton::OnSize( wxSizeEvent &WXUNUSED(event) )