DateTime Control

 

The DATETIME control is the WIL Dialog implementation of the Date and Time Picker Windows Common Control. It can be used to both display and receive date and time input in multiple formats.

Some format possible are:

-As a DEFAULT, date text displayed as MM/DD/YYYY with a drop down calendar.

-Design your own text display of Date/Time using control's "Format" attributes.  Weekday name, name of month, am/pm notation, additional text elements can be specified.

-Drop down calendar can be replaced with a spinner to change the date/time.

-Drop down calendar can specify a minimum and maximum value display.

Return Value:

The DATETIME control will return the date/time shown in the control in YYYY:MM:DD:HH:MM:SS format.  Optionally, the control can contain a vertical bar(|) delimited list of YMDHMS date and time values.  The first item of the list is used as the control's initial date/time.  The second item is the minimum date/time the control will accept and the third item is the maximum date/time the control will accept.

Control Definition:

 

<dlg-variable>nn =`x, y, width, height, type, control-name, variable, text, value, tab-order, style, font, textcolor, backgroundcolor`

 

For Example:

MyDialog003=`055,025,072,012,DATETIME,"DateTime_1",dtVariable1,DEFAULT,DEFAULT,30,DEFAULT,DEFAULT,DEFAULT,DEFAULT`

 

Attribute

Value

Meaning

dlg-variable

MyDialog

The name of the dialog box.

nn 

003

The ordinal position of the control in the dialog box (starting with 1).

x

055

The horizontal coordinate of the upper left corner of the control in Dialog Units.

y

025

The vertical coordinate of the upper left corner of the control in Dialog Units.

width

072

The width of the control in Dialog Units.

height

012

The height of the control in Dialog Units.

type 

DATETIME

The type of control.

control-name

"DateTime_1"

The name used to identify the control in a user defined callback procedure. The name cannot be more than 30 characters in length and MUST be unique. ( This attribute can only be used with 6.2 or later dialog formats. )

variable

dtVariable1

The name of a variable that receives the user selected date/time from the control on a non-canceling exit from the dialog. Optionally, the variable can contain a vertical bar(|) delimited list of YMDHMS date and time values.  The first item of the list is used as the control's initial date/time.  The second item is the minimum date/time the control will accept and the third item is the maximum date/time the control will accept.  Use an empty list element to use the control's default for the respective item. Use DEFAULT instead of a variable name to set the date/time to the current date/time with control defined limits.  

text

"DEFAULT"

The text attribute is used to indicate the date/time format the control displays. Specifying 'DEFAULT' or using an empty string causes the control to use the current system default date format.  The following table lists the standard Windows date/time format characters accepted and interpreted by the control.  Nonformat characters are accepted but they must be with a few exceptions enclosed in single (') quotes.

Format

Used For

Description

d

Days

Displays the day as a number from 1 to 31

dd

Days

Displays the day as a number with a leading 0 if the number is less than 10

ddd

Weekdays

Displays a weekday name with 3 letters as Mon, Tue, etc

dddd

Weekdays

Displays the complete name of a week day as Monday, etc

M

Months

Displays the numeric month from 1 to 12

MM

Months

Displays the numeric month with a leading 0 if the number is less than 10

MMM

Months

Displays the short name of the month as Jan, Feb, Mar, etc

MMMM

Months

Displays the complete name of the month as January, etc

yy

Years

Displays two digits for the year as 16 for 2016 or 03 for 2003

yyyy

Years

Displays the numeric year with 4 digits

h

Hours

Hours with no leading zero for single-digit hours; 12-hour clock

hh

Hours

Hours with leading zero for single-digit hours; 12-hour clock

H

Hours

Hours with no leading zero for single-digit hours; 24-hour clock

HH

Hours

Hours with leading zero for single-digit hours; 24-hour clock

m

Minutes

Minutes with no leading zero for single-digit minutes

mm

Minutes

Minutes with leading zero for single-digit minutes

s

Seconds

Seconds with no leading zero for single-digit seconds

ss

Seconds

Seconds with leading zero for single-digit seconds

t

Time Mark

One-character abbreviation (for example, A or P)

tt

Time Mark

Two-character abbreviation (for example, AM or PM)

 

value

DEFAULT

Not applicable to this control.

tab-order

30

Allows you to specify a control's tab order independently of a control's position or name in the dialog template. Tab-order controls the order in which controls are accessed when the keyboard is used to navigate the dialog. It also influences which control is on top when controls have overlapping positions in the dialog. It can be any positive integer, but each control should have a unique number.

When you navigate through a dialog using the tab key, lower number controls will be given the keyboard focus before higher controls. Likewise, low-numbered overlapping controls will appear on top of higher numbered controls. If you specify the DEFAULT keyword for this attribute or if you give two controls the same tab order, a tab order will be arbitrarily assigned to the control.

Note: The dialog function, under certain circumstances, may change the tab order you specify. The GROUPBOX controls tab order may be adjusted so that it is smaller than any of the controls it contains. In addition, the tab order of the controls inside the GROUPBOX may be adjusted so that they are consecutive.

style 

DEFAULT

Allows you to control the initial appearance and behavior of your control. Numbers represent each style and they can be combined, using the bit-wise OR (|) operator, to set multiple styles. The following table lists the style numbers, their meanings, and the controls that they have an effect on.

Style

Meaning

@csInvisible (1)

Control is invisible

@csDisabled (2)

Control has disabled appearance and does not accept any user input, it would otherwise accept input.

@csCheckbox (134217728)

Adds a check box that indicates no date/time value when unchecked.

@csSpinner (536870912)

Replaces the controls drop down calendar with a spinner.  The spinner can be used to change the value of individual elements of the displayed date/time.

Note: Specifying 0 for this attribute is equivalent to using the DEFAULT keyword and means that the control will exhibit default behavior.

font 

DEFAULT

Sets the display font for both the edit and drop down calendar elements of the control. The font description should be delimited by double quote (") marks unless the attribute is set to DEFAULT. If this attribute is set to DEFAULT, the font specified as the value of the main dialog font will be used. If the main dialog font is set to DEFAULT, the system font is used. You do not need to provide any value for this attribute unless you are also specifying text or background color. For details see the Dialog Fonts topic. WARNING: If a font is selected that doesn't exist on the user's system, a substitution will be made. We recommend using commonly available fonts.

textcolor 

DEFAULT

Sets the text color for the drop down calendar element only. Color is specified by three vertical bar (|) delimited numbers ranging from 0 to 255 or a single hexadecimal number preceded by the letter 'h'. The numbers represent one of the RGB colors: red, green or blue, in that order. The complete color specification must be surrounded by double quotes (") unless the DEFAULT key word is used. If this attribute is set to DEFAULT, the color listed in the main dialog's textcolor will be used. If a color is not specified for the dialog, the system text color will be used.

backgroundcolor 

DEFAULT

Sets the background color for the drop down calendar element only. Color is specified by three vertical bar (|) delimited numbers ranging from 0 to 255 or a single hexadecimal number preceded by the letter 'h'. The numbers represent one of the RGB colors (red, green or blue, in that order). The complete color specification must be surrounded by double quotes (") unless the DEFAULT keyword is used. If no color is specified or the DEFAULT keyword is used the system background color will be used.

 

Event Options

Use the DialogProcOptions function to control when your User-Defined-Callback procedure is called by its associated dialog. You can also use it to control your dialog's behavior, while your procedure is executing. You usually establish callback events during the first call to the procedure i.e., event 0, but this can be done during any call.

Event-Option-Code Values

Meaning

@deDtChange(23)

Date or time change: user has changed the date/time.  This event also fires if the date/time range is changed and the current value of the DATETIME control does not fall within that range. The new control date/time is passed to user defined callbacks in the callback's fifth parameter.

 

 

Dialog Callback Procedure Function Options

DialogControlGet function returns text and state information associated with a control.

Request

Meaning

@dcText(3)

Request code to obtain the date/time as text in the format displayed by the control.

@dcDate(7)

Request code to obtain the date/time shown in the control in YYYY:MM:DD:HH:MM:SS format. The @dcTitle request code cannot be used to obtain the displayed date.

@dcBackColor (11)

Background color specified by three vertical bar (|) delimited numbers ranging from 0 to 255. If the control is using the system default color, the string "DEFAULT" is returned.

@dcTextColor (13)

Text color specified by three vertical bar (|) delimited numbers ranging from 0 to 255. If the control is using the dialog's default text color, the string "DEFAULT" is returned.

@dcPosition (17)

Space delimited list of a control's position and size in dialog units relative to the dialog's client area. The first two numbers are the horizontal and vertical location of the upper-left corner of the control while the third and fourth numbers are the width and height of the control.

@dcMenuNames (18)

Tab delimited list of menu item names associated with the control, menu item or menu bar.

@dchWnd (19)

Window handle of a dialog control.

@dcFormat(28)

Returns control's current format as a string.  The function returns an empty string if no format was previously specified.  

 

DialogControlSet function changes the text or appearance of a control.

Request

Meaning

@dcDate(7)

Set the date/time shown in the control.  The date/time must be in the YYYY:MM:DD:HH:MM:SS format. The controls range can also be set using a vertical bar(|) delimited list of YMDHMS date and time values.  Neither the @dcText nor @dcTitle request code can be used to set the displayed date.   

@dcBackColor (11)

Background color. The color is specified by three vertical bar (|) delimited numbers ranging from 0 to 255 or a single hexadecimal number preceded by the letter 'h'. To give the control the system default background color, use an empty string ""or the "DEFAULT "key string for this parameter.

@dcTextColor (13)

Text color. The color is specified by three vertical bar (|) delimited numbers ranging from 0 to 255 or a single hexadecimal number preceded by the letter 'h'.  To give the control the dialog's default text color, use an empty string ""or the "DEFAULT "key string for this parameter

@dcPosition (17)

Space delimited list of a control's position and size in dialog units relative to the dialog's client area. The first two numbers are the horizontal and vertical location of the upper-left corner of the control while the third and fourth numbers are the width and height of the control.

@dcFormat(28)

Sets control's current display format using the special format characters also used in the control's template text attribute.

 

DialogControlState function changes a control’s style or gives control input focus.

Style

Meaning

@csInvisible (1)

Control is invisible

@csDisabled (2)

Control has disabled appearance and does not accept any user input, it would otherwise accept input.

@csCheckbox (134217728)

Adds a check box that indicates no date/time value when unchecked.

@csSpinner (536870912)

Replaces the controls drop down calendar with a spinner.  The spinner can be used to change the value of individual elements of the displayed date/time.

 

The DialogControlState request code @dcsGetStyle can be used to determine whether or not the @csCheckBox and @csSpinner styles are set for the DATETIME control  However, the @dcsRemStyle or @dcsAddStyle request codes cannot be used to change the @csCheckbox and @csSpinner styles.  The @dcsRemStyle or @dcsAddStyle request codes can be used to change the DATETIME control's @csInvisible and @csDisabled styles.

 

 

 

 

§         Dialog

§         Dialog Overview

§         Defining the Dialog

§         Defining the Dialog Controls

§         Dialog Control Types

§         Dynamic Dialogs

§         InternetExplorer Controls

§         Dialog Units

§         Dialog Fonts

 

Control Types

§         Calendar

§         Checkbox

§         ComControl

§         DateTime

§         DropListbox

§         Editbox

§         FileListbox

§         Groupbox

§         Itembox

§         MenuBar

§         MenuItem

§         MultiLinebox

§         Picture

§         PictureButton

§         PushButton

§         RadioButton

§         ReportView

§         Spinner

§         StaticText

§         VaryText