DateSelector

(System Library)

Description: Displays a calendar, from which operators can select a date.
Returns: Timestamp (within a parameter).
Usage: Steady State only.
Function Groups: Time and Date, Graphics
Related to: Date | DateNum | Today
Format: \DateSelector(ShowSelector, LeftParm, TopParm, PSelTimestamp[, HelpID, MinTimestamp, MaxTimestamp, pWidth, pHeight, DisabledDays, BackColorParm, TextColorParm, FontSizeParm, HighlightToday, FirstDayofWeek])
Parameters:  
ShowSelector
Sets the display mode. 1 to temporarily open the popup DateSelector. 2 to permanently show an embedded DateSelector.
Also used as a return value: 0 indicates that a date was selected, -1 indicates that the operator closed the popup without selecting a date.
LeftParm
Any numeric expression specifying the location of the left edge of the calendar.
TopParm
Any numeric expression specifying the location of the top edge of the calendar.
pSelTimestamp
Output. A pointer to a variable holding a timestamp value. The returned date from the calendar will be found here. You may also use this to hand an initial date to the calendar, to display when ShowSelector becomes true. If the initial date is not in range and no other date is selected, then the parameter will return invalid. No timestamp is returned if no date is selected.
HelpID
(Optional) Specific HelpID for this use of the DateSelector.
MinTimestamp
(Optional) Minimum selectable date. (the number of seconds, in local or UTC time, since midnight of January 1, 1970 (where "midnight" is 00:00) to the minimum selectable date.)
MaxTimestamp
(Optional) Maximum selectable date. (the number of seconds, in local or UTC time, since midnight of January 1, 1970 (where "midnight" is 00:00) to the maximum selectable date.)
pWidth
(Optional) Returns pointer set to width of the calendar.
pHeight
(Optional) Returns pointer set to height of the calendar.
DisabledDays
(Optional) Bitwise. Days of the week that are disabled: 0bSFTWTMS, read right-to-left. eg. 0b1110001 disables Sunday, Thursday, Friday. Saturday.
BackColorParm
(Optional) Background color. Default <FFFFFFFF> (white).
TextColorParm
(Optional) Text color. Default <FF000000> (black).
FontSizeParm
(Optional) Selected font size.
0 = small (default)
1 = medium
2 = large
3 = X-large
4 = XX - large
HighlightToday
(Optional) Boolean. TRUE to highlight today's date. Default TRUE.
FirstDayOfWeek
(Optional) The weekday considered first (Sunday = 0).
Comments: The function returns an object variable of itself upon starting, in case the calling module requires it.
You can monitor the value of ShowSelector to know whether the operator selected a date (ShowSelector becomes 0). If the calendar is shown as a popup, ShowSelector becomes -1 if the calendar is closed without choosing a new date.

Examples:

[
  ShowPopup;
  PopupLeft = 700;
  PopupTop = 550;
  Timestamp;

  MinTimestamp;
  MaxTimestamp;

  Width;
  Height;

  DisabledDays;
  BackColor;
  TextColor;
  FontSize;
  HighlightToday;
  FirstDayOfWeek;
]

Main [
  System.DateSelector(2, 0, 0, &Timestamp, Invalid,
                      MinTimestamp, MaxTimestamp,
                      &Width, &Height,
                      DisabledDays, BackColor, TextColor,
                      FontSize, HighlightToday, FirstDayOfWeek);
  System.DateSelector(2, Width + 10, 0, &Timestamp);
  System.DateSelector(ShowPopup, PopupLeft, PopupTop, &Timestamp, Invalid,
                      MinTimestamp, MaxTimestamp,
                      Invalid, Invalid,
                      DisabledDays, BackColor, TextColor,
                      FontSize, HighlightToday, FirstDayOfWeek);

  If ZButton(PopupLeft, PopupTop, PopupLeft + 100, PopupTop + 50, "Popup Calendar", 1);
  [
    ShowPopup = 1;
  ]
]