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.
This commit is contained in:
parent
b4b6975bad
commit
f417248434
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user