wxDatePicker week numbers

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
timo123
In need of some credit
In need of some credit
Posts: 2
Joined: Wed May 09, 2018 8:12 pm

wxDatePicker week numbers

Post by timo123 »

Hi, I am trying to use the wxdatepicker, but actually show week numbers when the dropdown is shown (wxWidgets 3.0.4 with Windows 10). Although the wxCalendarCtrl nicely shows the week numbers, I don't seem to be able to get it up-and-running for the wxDatePickerCtrl. Microsoft docuumentation does show that it should be possible, but I'm not sure where I should change parameters.

Any help is very much appreciated.
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxDatePicker week numbers

Post by doublemax »

timo123 wrote:Microsoft docuumentation does show that it should be possible, but I'm not sure where I should change parameters..
Where do you see that? I don't see anything here: https://msdn.microsoft.com/en-us/librar ... 00%29.aspx

I should work with the generic implementation:

Code: Select all

#include "wx/datectrl.h"
#include "wx/generic/datectrl.h"
#include "wx/calctrl.h"

///

wxDatePickerCtrlGeneric *dp = new wxDatePickerCtrlGeneric(panel, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DEFAULT );
dp->GetCalendar()->SetWindowStyleFlag( wxCAL_SHOW_WEEK_NUMBERS );
Use the source, Luke!
timo123
In need of some credit
In need of some credit
Posts: 2
Joined: Wed May 09, 2018 8:12 pm

Re: wxDatePicker week numbers

Post by timo123 »

That's awesome! Thanks a lot. There was some logic to set the style in the DTN_DROPDOWN notification message. I tried, but had a hard time resizing the window correctly. This is much nicer of course.

Timo
Post Reply