From 6c1de05621a8d558eabb59547aee825766c84d6c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 23 Mar 2011 10:37:38 +0000 Subject: [PATCH] Prevent event generation in wxGtkCalendarCtrl::SetDate(). Block not only gtk_day_selected_callback() but also gtk_month_changed_callback() as we don't want wxEVT_CALENDAR_PAGE_CHANGED generated neither when calling SetDate(). This fixes partial resetting of the just set value in wxDatePickerCtrl as calling SetDate() there resulted in the date being reset from inside it and the behaviour of the control was clearly wrong as could be seen in the widgets sample. Closes #13073. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67293 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/calctrl.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gtk/calctrl.cpp b/src/gtk/calctrl.cpp index 488926dec4..24b1d73347 100644 --- a/src/gtk/calctrl.cpp +++ b/src/gtk/calctrl.cpp @@ -142,6 +142,8 @@ bool wxGtkCalendarCtrl::SetDate(const wxDateTime& date) { g_signal_handlers_block_by_func(m_widget, (gpointer) gtk_day_selected_callback, this); + g_signal_handlers_block_by_func(m_widget, + (gpointer) gtk_month_changed_callback, this); m_selectedDate = date; int year = date.GetYear(); @@ -150,6 +152,8 @@ bool wxGtkCalendarCtrl::SetDate(const wxDateTime& date) gtk_calendar_select_month(GTK_CALENDAR(m_widget), month, year); gtk_calendar_select_day(GTK_CALENDAR(m_widget), day); + g_signal_handlers_unblock_by_func( m_widget, + (gpointer) gtk_month_changed_callback, this); g_signal_handlers_unblock_by_func( m_widget, (gpointer) gtk_day_selected_callback, this); -- 2.45.2