From f4172484348e4315edb138b3ed9eb3a65970f78c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 6 Dec 2015 19:43:24 +0100 Subject: [PATCH] Don't call event handler from another handler We advise people to not call the event handlers directly, so don't show bad example in our own code and just handle double clicks directly instead of forwarding them to the single click handler. Alternatively, we could just handle both events in the same handler. --- src/generic/calctrlg.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/generic/calctrlg.cpp b/src/generic/calctrlg.cpp index 4c91d266b1..ed2f38ddfa 100644 --- a/src/generic/calctrlg.cpp +++ b/src/generic/calctrlg.cpp @@ -1325,7 +1325,8 @@ bool wxGenericCalendarCtrl::GetDateCoord(const wxDateTime& date, int *day, int * void wxGenericCalendarCtrl::OnDClick(wxMouseEvent& event) { - switch ( HitTest(event.GetPosition()) ) + wxDateTime date; + switch ( HitTest(event.GetPosition(), &date) ) { case wxCAL_HITTEST_DAY: GenerateEvent(wxEVT_CALENDAR_DOUBLECLICKED); @@ -1333,9 +1334,9 @@ void wxGenericCalendarCtrl::OnDClick(wxMouseEvent& event) case wxCAL_HITTEST_DECMONTH: case wxCAL_HITTEST_INCMONTH: - // allow quickly clicking the inc/dec button any number of - // times in a row by handling also the double-click event. - OnClick(event); + // Consecutive simple clicks result in a series of simple and + // double click events, so handle them in the same way. + SetDateAndNotify(date); break; default: