Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5d

Application v 5.25a

  

 

Chapter NineDialog Functions (continued)

9.13 Date/Time Control

9.13.1 Introduction

The Date/Time Control functions are designed to operate with the Windows common control “SysDateTimePick32” or the alias “DateTimeControl”. Date and time information is moved into and out of the control using ISO-8601 formatted strings. Depending on the context, only portions of the ISO-8601 structure are employed.

By default, the control will be a date control unless the DTS_TIMFORMAT style is used. In order to have a date and time control, two separate controls must be employed.

To set a date or time in a control, an ISO-8601 format string is sent to the control using the DateControlSet or TimeControlSet functions. If the control is setup to process dates, the time is ignored. Likewise, if the control is set up to display time, the date portion of the ISO-8601 field is ignored. The DateControlGet and TimeControlGet will retrieve the date or time depending on the function call settings.

9.13.2 Control Styles

The look, style and behavior of the control varies dramatically depending on the styles set for the control window. Further, the presentation will vary depending on the locale settings for Windows. These are applied to the resource or can be sent directly to the control.

  Define   Value   Description
  DTS_APPCANPARSE       Allows the owner to parse user input and take necessary action. It enables users to edit within the client area of the control when they press the F2 key. The control sends DTN_USERSTRING notification codes when users are finished.
  DTS_LONGDATEFORMAT       Displays the date in long format. The default format string for this style is defined by LOCALE_SLONGDATEFORMAT, which produces output like “Friday, April 19, 1996”. When this style is used, the dropdown button does not display an icon.
  DTS_RIGHTALIGN       The drop-down month calendar will be right-aligned with the control instead of left-aligned, which is the default.
  DTS_SHOWNONE       It is possible to have no date currently selected in the control. With this style, the control displays a check box that is automatically selected whenever a date is picked or entered. If the check box is subsequently deselected, the application cannot retrieve the date from the control because, in essence, the control has no date. The state of the check box can be set with the DTM_SETSYSTEMTIME message or queried with the DTM_GETSYSTEMTIME message.
  DTS_SHORTDATEFORMAT       Displays the date in short format. The default format string for this style is defined by LOCALE_SSHORTDATE, which produces output like “4/19/96”.
  DTS_SHORTDATECENTURYFORMAT       Similar to the DTS_SHORTDATEFORMAT style, except the year is a four-digit field. The default format string for this style is based on LOCALE_SSHORTDATE. The output looks like: "4/19/1996".
  DTS_TIMEFORMAT       Displays the time. The default format string for this style is defined by LOCALE_STIMEFORMAT, which produces output like “5:31:42 PM”.
  DTS_UPDOWN       Places an up-down control to the right of the DTP control to modify date-time values. This style can be used in place of the drop-down month calendar, which is the default style.

 

The client area of a Date/Time Control displays date or time information, or both, and acts as the interface through which users modify the information. The date can be selected from a calendar or by using an up-down control; the time can be changed by typing in fields that are defined by the control's Format Strings. Optionally, the control displays a check box. When it is checked, the value in the control can be retrieved; otherwise, the control is considered to be uninitialized.

The following illustration shows a dialog that contains three date-picker controls. The first Date/Time Control was created with the DTS_SHOWNONE style, the second with the DTS_UPDOWN style, and the third with no special styles. In the third control, the user has clicked the down arrow to display the calendar.

The following illustration shows a window with three controls that contain the time.

The first control has been created with the DTS_TIMEFORMAT style and shows the time in the default time which consists of four fields. The user can type a valid value in any of these fields or select the field and change the value by using the up-down control or arrow keys.

The second control shows a custom format set by using [DateTimeControlSetFormat]. As with the first control, the user can change the time fields by typing or by using arrow keys. The day of the week can be changed by selecting a date from the calendar that opens when the user clicks on the down arrow.

The third control shows how arbitrary text can be added to the control. The user can select an hour (from 1 to 24) by typing, by using the arrow keys, or by using the up-down control.

The Date Control automatically updates internal information based on the user's input.

9.13.3 Notifications

Date/Time Controls will send DTN_ notifications via the “notify” or “action” procedure. These are:

  Define   Value   Description
  DTN_CLOSEUP       Indicates that the drop-down month calendar is about to be removed.
  DTN_DATETIMECHANGE       Signals a change within the Date Control.
  DTN_DROPDOWN       Indicates that the drop-down month calendar is about to be displayed.
  DTN_FORMATQUERY       Requests information about the maximum allowable size of the text to be displayed in a callback field.
  DTN_USERSTRING       Signals the end of a user's edit operation within the control. This notification is sent only by DTP controls that use the DTS_APPCANPARSE style.
  DTN_WMKEYDOWN       Signals that the user has pressed a key in a callback field of the Date Control.

 

Default notifications, such as focus change, are sent via the notify procedure only.

9.13.4 Functions

Page revised 2024-12-13