Curses:...alendar(3)

hiii bestie πŸ’– welcome to Curses::UI::Calendar(3) from the User Contributed Perl Documentation β€” this is the calendar widget page, and it's lowkey iconic. no cap, we're keeping every detail.

πŸ’– NAME πŸ’–

Curses::UI::Calendar β€” Create and manipulate calendar widgets ✨

🌸 CLASS HIERARCHY 🌸

the family tree is giving main character energy:

Curses::UI::Widget
   |
   +----Curses::UI::Calendar

✨ SYNOPSIS ✨

okay so the synopsis is exactly this, don't @ me:

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();

πŸŽ€ DESCRIPTION πŸŽ€

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. πŸ’…

πŸ’… STANDARD OPTIONS πŸ’…

These are the standard options, bestie β€” full explanations live in Curses::UI::Widget:

  • -parent β€” standard option, explained in Curses::UI::Widget.
  • -x β€” standard option, explained in Curses::UI::Widget.
  • -y β€” standard option, explained in Curses::UI::Widget.
  • -width β€” standard option, explained in Curses::UI::Widget.
  • -height β€” standard option, explained in Curses::UI::Widget.
  • -pad β€” standard option, explained in Curses::UI::Widget.
  • -padleft β€” standard option, explained in Curses::UI::Widget.
  • -padright β€” standard option, explained in Curses::UI::Widget.
  • -padtop β€” standard option, explained in Curses::UI::Widget.
  • -padbottom β€” standard option, explained in Curses::UI::Widget.
  • -ipad β€” standard option, explained in Curses::UI::Widget.
  • -ipadleft β€” standard option, explained in Curses::UI::Widget.
  • -ipadright β€” standard option, explained in Curses::UI::Widget.
  • -ipadtop β€” standard option, explained in Curses::UI::Widget.
  • -ipadbottom β€” standard option, explained in Curses::UI::Widget.
  • -title β€” standard option, explained in Curses::UI::Widget.
  • -titlefullwidth β€” standard option, explained in Curses::UI::Widget.
  • -titlereverse β€” standard option, explained in Curses::UI::Widget.
  • -onfocus β€” standard option, explained in Curses::UI::Widget.
  • -onblur β€” standard option, explained in 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. πŸ‘‘

πŸ¦‹ WIDGET-SPECIFIC OPTIONS πŸ¦‹

  • -date < DATE > β€” 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)
    • YYYY/M/D β€” (e.g. 2002/1/10 or 2002/01/10))
    • YYYYMMDD β€” (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 < CODEREF > β€” This sets the onChange event handler for the calendar widget. If a new date is selected, the code in CODEREF will be executed. It will get the widget reference as its argument. 🫢
  • -drawline < CODEREF > β€” This option specifies whether or not a line should be drawn under the calendar.

🌈 METHODS 🌈

standard squad first β€” all explained in Curses::UI::Widget:

  • new ( OPTIONS )
  • layout ( )
  • draw ( BOOLEAN )
  • focus ( )
  • onFocus ( CODEREF )
  • onBlur ( CODEREF )
  • intellidraw ( )

These are standard methods. See Curses::UI::Widget for an explanation of these.

then the calendar-specific faves:

  • get ( ) β€” This method will return the currently selected date in the format 'YYYY-MM-DD'. πŸ’–
  • setdate ( DATE, [BOOLEAN] ) β€” Set the selected date of the widget to DATE. See -date above for the possible formats. The widget will redraw itself, unless BOOLEAN has a true value.
  • onChange ( CODEREF ) β€” This method can be used to set the -onchange event handler (see above) after initialization of the calendar.

πŸ”₯ DEFAULT BINDINGS πŸ”₯

  • <tab> β€” Call the 'loose-focus' routine. This will have the menubar loose its focus and return the value 'LOOSE_FOCUS' 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>, <SHIFT+K> β€” Call the 'date-prevmonth' routine. This will have the date cursor go back one month.
  • <page-down>, <SHIFT+J> β€” Call the 'date-nextmonth' routine. This will have the date cursor go forward one month.
  • <p>, <SHIFT+H> β€” Call the 'date-prevyear' routine. This will have the date cursor go back one year.
  • <n>, <SHIFT+L> β€” Call the 'date-nextyear' routine. This will have the date cursor go forward one year.
  • <home>, <CTRL+A>, <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.

πŸ‘‘ SEE ALSO πŸ‘‘

go look at Curses::UI, Curses::UI::Widget, and Curses::UI::Common β€” the whole friend group πŸ’–

πŸ’œ AUTHOR πŸ’œ

Copyright (c) 2001-2002 Maurice Makaay. All rights reserved.

Maintained by Marcus Thiesen (marcus@cpan.thiesenweb.de).

This package is free software and is provided "as is" without express or implied warranty. It may be used, redistributed and/or modified under the same terms as perl itself.

πŸ’– cute sign-off: this page is from perl v5.42.2, dated 2023-07-03. bye bestie, go pick a date and slay πŸ’…βœ¨

πŸ“¦ where this page comes from