kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #10443
Re: Patch for hand-modifiable issue date
On Sun, May 19, 2013 at 12:09:42PM -0400, Wayne Stambaugh wrote:
> Yes. It's possible that I misunderstood the documentation. Also,
> I'm not sure if on GTK+ that the native control or the generic
> control is used so that could also impact the behavior. Sometimes
> the only way to know for sure is to code and see an what happens.
The native control uses the numeric format; it's easily tried using the
samples/widget demo in the wx distribution (and BTW it only supports the
default format, trying a change triggers an asserts)
> I wonder if the wxControl::GetText() function would return the
> properly formatted date string directly from the control rather than
> using wxDatePickerCtrl::GetValue(). It might be worth a try.
Probably it returns the date as shown on the text edit (it's more or
less an edit box with a button besides which opens a full calendar
control); sadly it's in numeric format which (often) is not what the
user wants. If the numeric format is acceptable the %x modifier can make
it from a wxDateTime without problem even on 2.8, without resorting to
trying a GetText on the picker.
Anyway it seems that wxDateTime is simply a struct tm reinvented for
C++...
I'd prefer to not lose the 'free form' approach for the date field; also
using a date picker as a 'main' field (not only as a source for setting)
would require parsing the date (with subsequent locale issue when
exchanging files!). As usual think about how to parse 01/02/2013 coming
from another country...
We could do something like this:
Date: [_Edit field_] [ <- Set ] [ Date Picker ]
^ This is a pushbutton
The edit field is freely editable and the date picker is initialized
with today. Pushing the 'set button' formats the date from the picker to
the edit field using the default locale format (on wx 2.8) or the long
locale format (available on 2.9).
I think in this way every plausible usage scenario would be handled
(except the 'autoset on modify').
The 'dual version' date format routine could be also used to add the
print date during plotting (or other dates, if needed)
--
Lorenzo Marcantonio
Logos Srl
Follow ups
References