DateSelector
(VTScada-Layer function. Must be called with a leading backslash.)
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, PtrNewDate, HelpID, MinDate, MaxDate) |
Parameters: |
ShowSelector |
Numeric. Used as a flag to enable and disable the display of the selector. Also used as a return value: 0 indicates that a date was selected, -1 indicates that the operator closed the dialog without selecting a date |
Left |
Any numeric expression specifying the location of the left edge of the calendar |
Top |
Any numeric expression specifying the location of the top edge of the calendar. |
ptrNewDate |
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 |
MinDate |
Minimun 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.) |
MaxDate |
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.) |
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, after making it true to show the calendar, to know whether the operator selected a date (ShowSelector becomes 0) or closed the calendar without choosing a new date (ShowSelector becomes -1). Note that the value within ptrNewDate is a timestamp in seconds, not a date value in days. |
Examples:
[ Title = "OverviewLabel"; Color = "<FFFFFFFF>"; StartDate; ShowCalendar; ] Main [ Return(Self); If !Valid(StartDate); [ StartDate = Today() * 86400; ] If GUIButton(100, 200, 200, 150, 1, 1, 1, 1, 1, 0, 0, 1, 0, 68, 2, 0, \ButtonFace, \ButtonHighlight, \ButtonShadow, \ButtonTextColor, 0, 0, \GetPhrase("ChangeLabel"), \GetPhrase("ChangeLabel"), \_DialogFont, 2, 1, 0); [ ShowCalendar = 1; ] \DateSelector(ShowCalendar, 200, 200, &StartDate); ]