]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/calctrl.cpp
don't send text changed events from ctor as wxGTK doesn't do it and people apparently...
[wxWidgets.git] / src / msw / calctrl.cpp
index 4a4c4d9ede388d047c251862565e84b65f466caa..37bd62296f4cd327c1a38c68670583c76abea863 100644 (file)
@@ -97,6 +97,8 @@ wxCalendarCtrl::Create(wxWindow *parent,
 
     UpdateMarks();
 
+    Connect(wxEVT_LEFT_DOWN,
+            wxMouseEventHandler(wxCalendarCtrl::MSWOnClick));
     Connect(wxEVT_LEFT_DCLICK,
             wxMouseEventHandler(wxCalendarCtrl::MSWOnDoubleClick));
 
@@ -328,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;
@@ -400,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