X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/db0b0942f8fe016db35fa00d6f2c5225cb61e529..d081739d4e1857cace594a43e653669b529ad41b:/src/msw/calctrl.cpp diff --git a/src/msw/calctrl.cpp b/src/msw/calctrl.cpp index a44ba3ae36..37bd62296f 100644 --- a/src/msw/calctrl.cpp +++ b/src/msw/calctrl.cpp @@ -56,6 +56,9 @@ wxCalendarCtrl::Create(wxWindow *parent, if ( !wxMSWDateControls::CheckInitialization() ) return false; + // we need the arrows for the navigation + style |= wxWANTS_CHARS; + // initialize the base class if ( !CreateControl(parent, id, pos, size, style, wxDefaultValidator, name) ) return false; @@ -94,6 +97,8 @@ wxCalendarCtrl::Create(wxWindow *parent, UpdateMarks(); + Connect(wxEVT_LEFT_DOWN, + wxMouseEventHandler(wxCalendarCtrl::MSWOnClick)); Connect(wxEVT_LEFT_DCLICK, wxMouseEventHandler(wxCalendarCtrl::MSWOnDoubleClick)); @@ -325,7 +330,7 @@ void wxCalendarCtrl::UpdateMarks() { MONTHDAYSTATE states[3]; const int nMonths = MonthCal_GetMonthRange(GetHwnd(), GMR_DAYSTATE, NULL); - wxCHECK_RET( nMonths <= WXSIZEOF(states), "unexpected months range" ); + wxCHECK_RET( nMonths <= (int)WXSIZEOF(states), "unexpected months range" ); for ( int i = 0; i < nMonths; i++ ) states[i] = m_marks; @@ -397,4 +402,13 @@ void wxCalendarCtrl::MSWOnDoubleClick(wxMouseEvent& event) event.Skip(); } +void wxCalendarCtrl::MSWOnClick(wxMouseEvent& event) +{ + // for some reason, the control doesn't get focus on its own when the user + // clicks in it + SetFocus(); + + event.Skip(); +} + #endif // wxUSE_CALENDARCTRL