OS X Cocoa wxDatePickerCtrl cannot be set to "no date"

13 views
Skip to first unread message

Fulvio Senore

unread,
May 28, 2012, 5:26:21 AM5/28/12
to wx-users
I am using a recent (less than one month) copy of 2.9 trunk and I have
just discovered that the Cocoa wxDatePickerCtrl has two problems:

1) There is not a drop down version.

2) it is not possible to set it to "no date".

The second problem is rather serious since very often in data entry,
especially for searches, leaving a control empty means "don't care". It
looks like it cannot be done with this control.

Both problems can be seen in the calendar sample.

Am I missing anything, or should I simply use the generic date picker
control?

Thanks in advance.

Fulvio Senore

Vadim Zeitlin

unread,
May 28, 2012, 8:56:52 AM5/28/12
to wx-u...@googlegroups.com
On Mon, 28 May 2012 11:26:21 +0200 Fulvio Senore wrote:

FS> I am using a recent (less than one month) copy of 2.9 trunk and I have
FS> just discovered that the Cocoa wxDatePickerCtrl has two problems:
FS>
FS> 1) There is not a drop down version.

No, only native version is currently supported. I thought about supporting
generic one as well but I am not sure if anybody is really going to use it
under Mac, it really looks rather out of place. We'd need to have a native
OS X version of wxCalendarCtrl first.

FS> 2) it is not possible to set it to "no date".

No, this is MSW-specific and I agree that it's unfortunate that it's not
available under other platforms but I just don't see how to implement it
there. It is documented as not being supported under OS X FWIW.

FS> Am I missing anything, or should I simply use the generic date picker
FS> control?

This is certainly one possibility...

Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/

John Roberts

unread,
May 28, 2012, 9:56:22 AM5/28/12
to wx-u...@googlegroups.com
On 28/05/2012 5:26 PM, Fulvio Senore wrote:
> I am using a recent (less than one month) copy of 2.9 trunk and I have
> just discovered that the Cocoa wxDatePickerCtrl has two problems:

> 2) it is not possible to set it to "no date".
> Fulvio Senore

I made a composite control for similar reasons.
A base class from wxNavigationEnabled<wxControl> and the control
incorporating wxCheckBox* and wxDatePickerCtrl*
It was more work but useful for database interfacing where the Apple
datepicker always reported a valid date and so that date would be stored
in the data column I had associated with the control. It might not meet
Apple's style guidelines though.

Regards, John


Fulvio Senore

unread,
May 28, 2012, 10:24:01 AM5/28/12
to wx-u...@googlegroups.com
This is a "minor" project and I was hoping to be able to use the
wxWidgets control to save some time, so I tested it.

For my main program I also created a custom control for entering dates.
I preferred to use the generic control as an inspiration, since I find
it more intuitive to have an empty control to mean "no date". Having to
click a checkbox to say the same thing seems more complicated, but it is
a matter of taste.
I also prefer having the whole date as a single string, so it is
possible, for example, to copy and paste. I also added some keyboard
shortcuts to quickly change day and month.

I could not use directly wxGenericDatePickerCtrl because under Windows
it kills tab navigation. You cannot tab out of it.

For this reason I derived my control from wxComboCtrl and it works well
under Windows. It still has the tab problem under Linux
(http://trac.wxwidgets.org/ticket/13840), and it has this problem under
OS X:

http://trac.wxwidgets.org/ticket/13841

Does you control have the same problem?

My program is approaching release time and those tickets are troubling me.
TAB navigation is a must for my program since users will make a lot of
data entry, so I am considering the idea of simply using a text control
with some keyboard shortcuts to handle dates under Linux and OS X, at
least until those tickets are fixed.

If you control does not have that problem it would be a good news.

Fulvio Senore

Fulvio Senore

unread,
May 28, 2012, 10:32:40 AM5/28/12
to wx-u...@googlegroups.com


Il 28/05/2012 14.56, Vadim Zeitlin ha scritto:
> On Mon, 28 May 2012 11:26:21 +0200 Fulvio Senore wrote:
>
> FS> I am using a recent (less than one month) copy of 2.9 trunk and I have
> FS> just discovered that the Cocoa wxDatePickerCtrl has two problems:
> FS>
> FS> 1) There is not a drop down version.
>
> No, only native version is currently supported. I thought about supporting
> generic one as well but I am not sure if anybody is really going to use it
> under Mac, it really looks rather out of place. We'd need to have a native
> OS X version of wxCalendarCtrl first.
>

I agree that having a native version would be good, but having a working
one is better than nothing.

There are kind of programs where users simply want to get the job done
as quickly and less painfully as possible: for example an accounting
program like the one that I am developing.

Users of such a program are rather different from the typical Mac user:
they are likely to prefer a working one to a good-looking one.

Anyway, I just reported this to let others know. My interest in
wxDatePickerCtrl is very low since I am using my own control. I care
much more of the problems that I have using that control, as I explained
in another message in this thread.

Fulvio

John Roberts

unread,
May 28, 2012, 10:37:07 AM5/28/12
to wx-u...@googlegroups.com
On 28/05/2012 10:24 PM, Fulvio Senore wrote:
> Il 28/05/2012 15.56, John Roberts ha scritto:
>> On 28/05/2012 5:26 PM, Fulvio Senore wrote:
>>> I am using a recent (less than one month) copy of 2.9 trunk and I have
>>> just discovered that the Cocoa wxDatePickerCtrl has two problems:
>>
>>> 2) it is not possible to set it to "no date".
>>> Fulvio Senore
>>
>> I made a composite control for similar reasons.
>> A base class from wxNavigationEnabled<wxControl> and the control
>> incorporating wxCheckBox* and wxDatePickerCtrl*
>> It was more work but useful for database interfacing where the Apple
>> datepicker always reported a valid date and so that date would be stored
>> in the data column I had associated with the control. It might not meet
>> Apple's style guidelines though.
>
> For my main program I also created a custom control for entering dates.
> I preferred to use the generic control as an inspiration, since I find
> it more intuitive to have an empty control to mean "no date". Having to
> click a checkbox to say the same thing seems more complicated, but it is
> a matter of taste.

I agree but I wanted some uniformity between msw and osx in my app.

> I could not use directly wxGenericDatePickerCtrl because under Windows
> it kills tab navigation. You cannot tab out of it.
>
> For this reason I derived my control from wxComboCtrl and it works well
> under Windows. It still has the tab problem under Linux
> (http://trac.wxwidgets.org/ticket/13840), and it has this problem under
> OS X:
>
> http://trac.wxwidgets.org/ticket/13841
>
> Does you control have the same problem?
> If you control does not have that problem it would be a good news.
>
> Fulvio Senore

It had that problem only when in a bookctrl page so I added some OnKey
code to make it work in that scenario. I haven't rebuilt on osx with the
recent bookctrl changes but will check when I do. Otherwise on a plain
panel or dialog there were no problems.
Regards, John

Fulvio Senore

unread,
May 28, 2012, 11:40:37 AM5/28/12
to wx-u...@googlegroups.com
Il 28/05/2012 16.37, John Roberts ha scritto:
>> Does you control have the same problem?
>> If you control does not have that problem it would be a good news.
>>
>> Fulvio Senore
>
> It had that problem only when in a bookctrl page so I added some OnKey
> code to make it work in that scenario. I haven't rebuilt on osx with the
> recent bookctrl changes but will check when I do. Otherwise on a plain
> panel or dialog there were no problems.
> Regards, John

Thank you for testing.

Fulvio
Reply all
Reply to author
Forward
0 new messages