Calendar Control

 

The CALENDAR control has a calendar-like user interface. This provides the user with a very intuitive and recognizable method of entering or selecting a date. A user can select a day from the current month and year by simply clicking on a day number. A user can scroll the months of the year by clicking the arrow buttons in the top left or top right of the control. To select a non-adjacent month, the user can click the name of a displayed month, and a pop-up menu appears that lists all months within the year. The user can select a month on the list. If the user clicks the year displayed next to a month name, a Spinner control appears in place of the year. The user can change the year with this control.

Normally, when a dialog box opens, the calendar defaults to today's date. You can change this by assigning a value in the format of YYY:MM:DD to the variable before calling the Dialog function. One may also specify a minimum and maximum date/time to display.

Return Value:

The CALENDAR control will return the users selection in the variable you supply as the Variable attribute in the controls definition. The date will be returned in the standard WIL YYYY:MM:DD:HH:MM:SS date time format.

Control Definition:

 

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

 

For Example:

MyDialog003=`005,005,088,DEFAULT,CALENDAR,"Calendar_1",caVariable1,DEFAULT,DEFAULT,30,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

005

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

y

005

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

width

088

The width of the control in Dialog Units

height

DEFAULT

The height of the control in Dialog Units. [This should be DEFAULT.]

type 

CALENDAR

The type of control.

control-name

"Calendar_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

caVariable1

The name of the variable affected by the control.

This variable can be used to display a calendar using a preset date in the format YYYY:MM:DD. 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.

Upon return this variable will contain the user selected date.

text

DEFAULT

Not applicable to this control.

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 the control. Constants represent each style and they can be combined, using the bit-wise OR (|) operator, to set multiple styles.

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.

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

font 

DEFAULT

The font used to display a control's text. 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

You cannot change the text color of this control.

backgroundcolor 

DEFAULT

You cannot change the background color of this control.

 

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

@deCaChange (9)

Calendar Date Change: User has selected a new date in a CALENDAR control.

 

Dialog Callback Procedure Function Options

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

Request

Meaning

@dcDate (7)

Date shown in the control in YYYY:MM:DD:HH:MM:SS format.

@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.

 

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 control's range can also be set using a vertical bar(|) delimited list of YMDHMS date and time values.

@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.

 

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.

 
 
 

 

§         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

§         DropListbox

§         Editbox

§         FileListbox

§         Groupbox

§         Itembox

§         MenuBar

§         MenuItem

§         MultiLinebox

§         Picture

§         PictureButton

§         PushButton

§         RadioButton

§         ReportView

§         Spinner

§         StaticText

§         VaryText