29 Dec 2019 03:23:20 UTC
- Distribution: Gtk2-Ex-DateSpinner
- Module version: 10
- Source (raw)
- Browse (raw)
- How to Contribute
- Testers (202 / 0 / 0)
- KwaliteeBus factor: 1
- License: gpl_3
- Perl: v5.8.0
- Activity24 month
- Download (51.6KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest versionKRYDE Kevin Rydeand 1 contributors
- Kevin Ryde
Gtk2::Ex::DateSpinner -- year/month/day date entry using SpinButtons
use Gtk2::Ex::DateSpinner; my $ds = Gtk2::Ex::DateSpinner->new (value => '2008-06-14');
Gtk2::Ex::DateSpinneris (currently) a subclass of
Gtk2::HBox, though it's probably not a good idea to rely on that.
Gtk2::Widget Gtk2::Container Gtk2::Box Gtk2::HBox Gtk2::Ex::DateSpinner
Gtk2::Ex::DateSpinnerdisplays and changes a year, month, day date using three
Gtk2::SpinButtonfields. The day of the week is shown to the right.
+------+ +----+ +----+ | 2008 |^ | 6 |^ | 14 |^ Sat +------+v +----+v +----+v
There's many ways to enter or display a date. This style is good for clicking to a nearby date but also allows a date to be typed in if a long way away.
If a click or entered value takes the day outside the days in the month then it wraps around to the next or previous month. Likewise the month wraps around to the next or previous year. When typing in a number the day of the week display updates when you press enter.
A paste of an ISO format YYYY-MM-DD date into any of the day, month or year fields sets the three fields to that value. Whitespace at the start or end of a paste is ignored.
Day of the week and date normalization calculations use
Date::Calcso they're not limited to the system
time_t(which may be as little as 1970 to 2038 on a 32-bit system). Day of the week display uses strftime() (via POSIX::Wide to allow non-ASCII) so gets the usual
LC_TIMElocalizations which are established by
setlocale()at Perl startup or Gtk initialization. The year/month/day tooltips (identifying the fields as year/month/day) use Gtk message translations.
See examples/simple.pl for a complete program creating a DateSpinner. See examples/builder.pl for similar using
$ds = Gtk2::Ex::DateSpinner->new (key=>value,...)
Create and return a new DateSpinner widget. Optional key/value pairs set initial properties per
my $ds = Gtk2::Ex::DateSpinner->new (value => '2008-06-14');
$dsto today's date (today in the local timezone).
value(string, default "2000-01-01")
The current date value, as an ISO format "YYYY-MM-DD" string. When you read this the day and month are always "normalized", so MM is 01 to 12 and DD is 01 to 28,29,30 or 31 (according to how many days in the particular month).
The default 1 January 2000 is meant to be fairly useless and you should set it to something that makes sense for the particular application.
There's very limited validation on the
valuestring, so don't set garbage.
Gtk2-Ex-DateSpinner is Copyright 2008, 2009, 2010, 2013, 2019 Kevin Ryde
Gtk2-Ex-DateSpinner is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
Gtk2-Ex-DateSpinner is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Gtk2-Ex-DateSpinner. If not, see http://www.gnu.org/licenses/.
Module Install Instructions
To install Gtk2::Ex::DateSpinner, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install Gtk2::Ex::DateSpinner
For more information on module installation, please visit the detailed CPAN module installation guide.