class PtCalendar PtBasic { calendar_color1; // color (Pt_ARG_CALENDAR_COLOR1) calendar_color2; // color (Pt_ARG_CALENDAR_COLOR2) calendar_color3; // color (Pt_ARG_CALENDAR_COLOR3) calendar_color4; // color (Pt_ARG_CALENDAR_COLOR4) calendar_color5; // color (Pt_ARG_CALENDAR_COLOR5) calendar_date; // long (Pt_ARG_CALENDAR_DATE) calendar_flags; // flag (Pt_ARG_CALENDAR_FLAGS) calendar_font1; // string (Pt_ARG_CALENDAR_FONT1) calendar_font2; // string (Pt_ARG_CALENDAR_FONT2) calendar_font3; // string (Pt_ARG_CALENDAR_FONT3) calendar_font4; // string (Pt_ARG_CALENDAR_FONT4) calendar_font5; // string (Pt_ARG_CALENDAR_FONT5) calendar_highlight; // long (Pt_ARG_CALENDAR_HIGHLIGHT) calendar_month_btn_color; // color (Pt_ARG_CALENDAR_MONTH_BTN_COLOR) calendar_month_names; // string array (Pt_ARG_CALENDAR_MONTH_NAMES) calendar_sel_color; // color (Pt_ARG_CALENDAR_SEL_COLOR) calendar_time_t; // long (Pt_ARG_CALENDAR_TIME_T) calendar_wday_names; // string array (Pt_ARG_CALENDAR_WDAY_NAMES) calendar_year_btn_color; // color (Pt_ARG_CALENDAR_YEAR_BTN_COLOR) }
This widget is a 6-line calendar that displays the days of the week for one month, and the year. You can control various aspects of the display, such as date colors, button colors, fonts, and name displays.
![]() | For detailed information, please refer to PtCalendar in the Photon documentation. |
Flags specifying display options, such as buttons for accessing previous and next years, months, and days, and a grid that separates the days and weeks.
This instance variable may be a combination of zero or more of the following flags:
| Constant | Description |
|---|---|
| Pt_CALENDAR_YEAR_BTNS | Show the buttons for the next and previous years. Default is ON. |
| Pt_CALENDAR_MONTH_BTNS | Show the buttons for the next and previous months. Default is ON. |
| Pt_CALENDAR_SHOW_PREV | Show the final days of the previous month. Default is ON. |
| Pt_CALENDAR_SHOW_NEXT | Show the first days of the next month. Default is ON. |
| Pt_CALENDAR_SHOW_GRID | Show the calendar as a grid, one block per day. Default is ON. |
A write-only array of exactly 7 elements:
[Su Mo Tu We Th Fr Sa]
that abbreviate the names of the days of the week. Assigning a new array will replace the existing values. If the new array has fewer than 7 elements, the missing elements will be supplied by the existing array. If the new array has more than 7 elements, the extra elements will not be used.
The following callback is associated with this widget:
| Callback | Description |
|---|---|
| Pt_CB_CALENDAR_SELECT | This callback is generated when a date is selected. |
This example, ex_PtCalendar.g, is included in the product distribution.
#!/usr/cogent/bin/phgamma
/*
* This example demonstrates a customized PtCalendar.
*/
require_lisp("PhotonWidgets.lsp");
PtInit(nil);
win = new(PtWindow);
cal = new(PtCalendar);
cal.SetDim(350,200);
cal.fill_color = 0xffddcc;
cal.calendar_font1 = "lu12b";
cal.calendar_color3 = 0x0000ff;
cal.calendar_color5 = 0xbb00bb;
cal.calendar_flags = cons(Pt_CALENDAR_SHOW_GRID,nil);
cal.calendar_month_btn_color = 0xff0000;
cal.calendar_sel_color = 0xffff00;
cal.calendar_wday_names = array("Sun","Mon","Tues","Wed","Thurs","Fri","Sat");
PtRealizeWidget(win);
PtMainLoop();
Copyright © 1995-2012 by Cogent Real-Time Systems, Inc. All rights reserved.