Create and manipulate calendar widgets
Curses::UI::Widget | +----Curses::UI::Calendar
use Curses::UI; my $cui = new Curses::UI; my $win = $cui->add('window_id', 'Window');
my $calendar = $win->add( 'mycalendar', 'Calendar', -date => '2002-1-14' );
$calendar->focus(); my $date = $calendar->get();
Curses::UI::Calendar is a widget that can be used to create a calendar in which the user can select a date. The calendar widget looks like this:
+----------------------+ | mmm dd yyyy | +----------------------+ | su mo tu we th fr sa | | | | 01 02 03 04 05 | | 06 07 08 09 10 11 12 | | 13 14 15 16 17 18 19 | | 20 21 22 23 24 25 26 | | 27 28 29 30 31 | +----------------------+
See exampes/demo-Curses::UI::Calendar in the distribution for a short demo.
-parent, -x, -y, -width, -height, -pad, -padleft, -padright, -padtop, -padbottom, -ipad, -ipadleft, -ipadright, -ipadtop, -ipadbottom, -title, -titlefullwidth, -titlereverse, -onfocus, -onblur
For an explanation of these standard options, see Curses::UI::Widget.
Remark: -width and -height can be set, but this widget really want to have its content space at a minimum size. If your -width or -height is not large enough, the widget will automatically fix its value.
-date < \s-1DATE\s0 > This option sets the date to start with. If you do not specify a date, today's date will be used automatically. The format that you can use for this date is one of: * YYYY-M-D (e.g. 2002-1-10 or 2002-01-10) * \s-1YYYY/M/D\s0 (e.g. 2002/1/10 or 2002/01/10)) * \s-1YYYYMMDD\s0 (e.g. 20020110) * D-M-YYYY (e.g. 10-1-2002 or 10/01/2002) * D/M/YYYY (e.g. 10/1/2002 or 10/01/2002)
-onchange < \s-1CODEREF\s0 > This sets the onChange event handler for the calendar widget. If a new date is selected, the code in \s-1CODEREF\s0 will be executed. It will get the widget reference as its argument.
-drawline < \s-1CODEREF\s0 > This option specifies whether or not a line should be drawn under the calendar.
new ( \s-1OPTIONS\s0 )
layout ( )
draw ( \s-1BOOLEAN\s0 )
focus ( )
onFocus ( \s-1CODEREF\s0 )
onBlur ( \s-1CODEREF\s0 )
intellidraw ( ) These are standard methods. See Curses::UI::Widget for an explanation of these.
get ( ) This method will return the currently selected date in the format '\s-1YYYY-MM-DD\s0'.
setdate ( \s-1DATE\s0, [\s-1BOOLEAN\s0] ) Set the selected date of the widget to \s-1DATE\s0. See -date above for the possible formats. The widget will redraw itself, unless \s-1BOOLEAN\s0 has a true value.
onChange ( \s-1CODEREF\s0 ) This method can be used to set the -onchange event handler (see above) after initialization of the calendar.
<tab> Call the 'loose-focus' routine. This will have the menubar loose its focus and return the value '\s-1LOOSE_FOCUS\s0' to the calling routine.
<enter>, <space> Call the 'date-select' routine. This will select the date on which the cursor is.
<cursor-left>, <h> Call the 'date-prevday' routine. This will have the date cursor go back one day.
<cursor-right, <l> Call the 'date-nextday' routine. This will have the date cursor go forward one day.
<cursor-down>, <j> Call the 'date-nextweek' routine. This will have the date cursor go forward one week.
<cursor-up>, <k> Call the 'date-prevweek' routine. This will have the date cursor go back one week.
<page-up>, <\s-1SHIFT+K\s0> Call the 'date-prevmonth' routine. This will have the date cursor go back one month.
<page-down>, <\s-1SHIFT+J\s0> Call the 'date-nextmonth' routine. This will have the date cursor go forward one month.
<p>, <\s-1SHIFT+H\s0> Call the 'date-prevyear' routine. This will have the date cursor go back one year.
<n>, <\s-1SHIFT+L\s0> Call the 'date-nextyear' routine. This will have the date cursor go forward one year.
<home>, <\s-1CTRL+A\s0>, <c> Call the 'date-selected' routine. This will have the date cursor go to the current selected date.
<t> Call the 'date-today' routine. This will have the date cursor go to today's date.
Curses::UI, Curses::UI::Widget, Curses::UI::Common
Copyright (c) 2001-2002 Maurice Makaay. All rights reserved.
Maintained by Marcus Thiesen ([email protected])
This package is free software and is provided \*(L"as is\*(R" without express or implied warranty. It may be used, redistributed and/or modified under the same terms as perl itself.