DatePicker control

A DatePicker control makes it easy for users to select a date. It has two parts: a drop-down list box that displays the date in a selected format, and a grid that resembles the MonthCalendar control. Unlike the MonthCalendar control, which can be used to select a range of dates, the DatePicker control is used to select a single date.

Properties

DatePicker property

Datatype

Description

Accelerator

Integer

Specifies the ASCII value of the key you want to assign as the accelerator key for a control.

AccessibleDescription

String

Describes the control and/or its purpose for use by accessibility tools such as readers for visually impaired users.

AccessibleName

String

A label that briefly describes the control, such as the text in a button or the name of a menu item.

AccessibleRole

AccessibleRole (enumerated)

Describes the kind of user interface element that the control is.

AllowEdit

Boolean

Specifies whether the user can select the text string in the control and edit it. Values are:

TRUE -- The user can select the text string in the control and edit it.

FALSE -- The user can change the date only by modifying one part of the date at a time or by selecting a date from the drop-down calendar (default).

Border

Boolean

Specifies whether the control has a border. Values are:

TRUE -- Control has a border (default).

FALSE -- Control does not have a border.

BorderStyle

BorderStyle (enumerated)

Specifies the style of the border of the control. Values are:

StyleBox!

StyleLowered!

StyleRaised!

StyleShadowBox!

BringToTop

Boolean

Specifies whether PowerBuilder moves the control to the top of the front-to-back order in the window. Values are:

TRUE -- Control moved to top.

FALSE -- Control not moved to top.

CalendarBackColor

Long

Specifies the numeric value of the background color of the calendar: -2 to 16,777,215. For more information about color, see the section called “RGB” in PowerScript Reference. The default is Window Background.

This property does not work on the Windows 7/8.1/10Windows 7/8.1/10 operating system.

CalendarFontCharset

FontCharSet (enumerated)

Specifies the font character set used for the text in the calendar. The default is ansi!. For a complete list of possible values, see the list of properties for the FontCharSet variable on the Enumerated tab page of the PowerBuilder Browser. This property cannot be set in the painter.

CalendarFontFamily

FontFamily (enumerated)

Specifies the font family (type style) used for the text in the calendar. Values are:

AnyFont!

Decorative!

Modern!

Roman!

Script!

Swiss!

To set this property in the painter, select the Browse button next to the FontName field on the Calendar page in the Properties view.

CalendarFontName

String

Specifies the name of the typeface in which the text in the calendar displays (for example, Arial or Tahoma).

To set this property in the painter, select the Browse button next to the FontName field on the Calendar page in the Properties view.

This property does not work on the Windows 7/8.1/10 operating system.

CalendarFontPitch

FontPitch (enumerated)

Specifies the pitch (spacing) of the font used for the text in the calendar. Values are:

Default!

Fixed!

Variable!

This property cannot be set in the painter.

CalendarFontWeight

Integer

Specifies the weight of the font in the calendar in the range 0 through 1000, where 400 is normal and 700 is bold. A default weight is used if FontWeight is 0. The default is normal.

To set this property in the painter, select the Browse button next to the FontName field on the Calendar page in the Properties view.

This property does not work on the Windows 7/8.1/10 operating system.

CalendarItalic

Boolean

Specifies whether the text in the calendar is italic. Values are:

TRUE -- Text is italic.

FALSE -- Text is not italic (default).

For more information, see Italic. To set this property in the painter, select the Browse button next to the FontName field on the Calendar page in the Properties view.

This property does not work on the Windows 7/8.1/10 operating system.

CalendarTextColor

Long

Specifies the numeric value of the text color in the calendar:

-2 to 16,777,215. For more information about color, see the section called “RGB” in PowerScript Reference. The default is Window Text.

This property does not work on the Windows 7/8.1/10 operating system.

CalendarTextSize

Integer

Specifies the size of text in the calendar. The default is 9. To set this property in the painter, select the Browse button next to the FontName field on the Calendar page in the Properties view.

CalendarTitleBackColor

Long

Specifies the numeric value of the background color of the calendar's title: -2 to 16,777,215. For more information about color, see the section called “RGB” in PowerScript Reference.

This property does not work on the Windows 7/8.1/10 operating system.

CalendarTitleTextColor

Long

Specifies the numeric value of the color used for text in the calendar's title: -2 to 16,777,215. For more information about color, see the section called “RGB” in PowerScript Reference.

This property does not work on the Windows 7/8.1/10 operating system.

CalendarTrailingTextColor

Long

Specifies the numeric value of the color used for leading and trailing days in the calendar: -2 to 16,777,215. For more information about color, see the section called “RGB” in PowerScript Reference.

This property does not work on the Windows 7/8.1/10 operating system.

CalendarUnderline

Boolean

Specifies that text in the calendar is underlined. The default is false. To set this property in the painter, select the Browse button next to the FontName field on the Calendar page in the Properties view.

This property does not work on the Windows 7/8.1/10 operating system.

ClassDefinition

PowerObject

An object of type PowerObject containing information about the class definition of the object or control.

CustomFormat

String

Specifies a custom format for the display of the date in a DatePicker control.

DateValue

Date

Gets the date value assigned to the control. The default is the current date. This property cannot be set in the painter and should not be set in script. Use the Value property to set the date value.

DragAuto

Boolean

Specifies whether PowerBuilder puts the control automatically into Drag mode. Values are:

TRUE -- When the control is clicked, the control is automatically in Drag mode.

FALSE -- When the control is clicked, the control is not automatically in Drag mode. You have to put the control into Drag mode manually by using the Drag function.

DragIcon

String

Specifies the name of the stock icon or the file containing the icon you want to display when the user drags the control (the ICO file). The default icon is a box the size of the control.

When the user drags the control, the icon displays when the control is over an area in which the control can be dropped (a valid drop area). When the control is over an area that is not a valid drop area, the No-Drop icon displays.

DropDownRight

Boolean

Specifies whether the drop-down calendar is aligned with the right or left side of the DatePicker control. Values are:

TRUE -- The calendar is aligned with the right side of the control.

FALSE -- The calendar is aligned with the left side of the control (default).

Enabled

Boolean

Specifies whether the control is enabled (can be selected). Values are:

TRUE -- Control can be selected (default).

FALSE -- Control cannot be selected.

FaceName

String

Specifies the name of the typeface in which the text of the control displays (for example, Arial or Tahoma).

FirstDayOfWeek

WeekDay (enumerated)

Specifies which day of the week displays on the left in the calendar.

FontCharSet

FontCharSet (enumerated)

Specifies the font character set used for the text in the control. The default is ansi!. For a complete list of possible values, see the list of properties for the FontCharSet variable on the Enumerated tab page of the Browser.

FontFamily

FontFamily (enumerated)

Specifies the font family (type style) used for the text in the control. Values are:

AnyFont!

Decorative!

Modern!

Roman!

Script!

Swiss!

FontPitch

FontPitch (enumerated)

Specifies the pitch (spacing) of the font used for the text in the control. Values are:

Default!

Fixed!

Variable!

FontWeight

Integer

Specifies the weight of the font in the control in the range 0 through 1000, where 400 is normal and 700 is bold. A default weight is used if FontWeight is 0.

Format

DateTimeValue (enumerated)

Specifies the format of the date displayed in a DatePicker control. Values are:

DtfCustom!

DtfLongDate!

DtfShortDate!

DtfTime!

Height

Integer

Specifies the height of the control in PowerBuilder units.

Italic

Boolean

Specifies whether the text in the control is italic. Values are:

TRUE -- Text is italic.

FALSE -- Text is not italic (default).

MaxDate

Date

Specifies the latest date the user can select from the calendar. The default is December 31, 2999.

MinDate

Date

Specifies the earliest date the user can select from the calendar. The default is January 1, 1800.

Pointer

String

Specifies the name of the stock pointer or the file containing the pointer used for the control.

RightToLeft

Boolean

Specifies that characters should be displayed in right-to-left order.

ShowUpDown

Boolean

Specifies whether the control uses an up-down control to change the date and/or time. Values are:

TRUE -- The control has an up-down control.

FALSE -- The control has a drop-down arrow that displays a calendar (default).

This property cannot be changed at runtime.

TabOrder

Integer

Specifies the tab value of the control within the window (0 means the user cannot tab to the control).

Tag

String

Specifies the tag value assigned to the control.

Text

String

Gets the text associated with the control. The string returned is equivalent to the Value property with the Format or CustomFormat applied. This property cannot be set in the painter and should not be set in script.

TextSize

Integer

Specifies the size of the text in the control, in points. For backward compatibility, the size is stored as a negative number; for example, 10-point text size is stored as -10.

TimeValue

Time

Gets the time value assigned to the control. The default is the current time. This property cannot be set in the painter and should not be set in script. Use the Value property to set the time value.

TodayCircle

Boolean

Specifies whether the border of today's date on the calendar displays in red. Values are:

TRUE -- The Today circle is displayed (default).

FALSE -- The Today circle is not displayed.

TodaySection

Boolean

Specifies whether the label "Today:" followed by the current date displays at the bottom of the calendar. Values are:

TRUE -- The Today section is displayed (default).

FALSE -- The Today section is not displayed.

This property does not work correctly on the Windows 7/8.1/10 operating system.

Underline

Boolean

Specifies whether the text in the control is underlined. Values are:

TRUE -- Text is underlined.

FALSE -- Text is not underlined (default).

Value

DateTime

Specifies the date/time value assigned to the control. The default is the current date and time.

Visible

Boolean

Specifies whether the control is visible. Values are:

TRUE -- Control is visible (default).

FALSE -- Control is not visible.

WeekNumbers

Boolean

Specifies whether a number representing the number of the week in the year displays to the left of each row in the calendar. Values are:

TRUE -- Week numbers are displayed.

FALSE -- Week numbers are not displayed (default).

This property does not work correctly on the Windows 7/8.1/10 operating system.

Width

Integer

Specifies the width of the control in PowerBuilder units.

X

Integer

Specifies the X position (the distance from the left edge of the window) in PowerBuilder units.

Y

Integer

Specifies the Y position (the distance from the top of the window) in PowerBuilder units.


Events

DatePicker event

Occurs

Clicked in PowerScript Reference

When the control is clicked (selected) with the left mouse button

CloseUp in PowerScript Reference

When the user has selected a date from the drop-down calendar and the calendar closes

Constructor in PowerScript Reference

Immediately before the Open event occurs in the window

Destructor in PowerScript Reference

Immediately after the Close event occurs in the window

DoubleClicked in PowerScript Reference

When the control is clicked twice with the left mouse button

DragDrop in PowerScript Reference

When a dragged control is dropped on the control

DragEnter in PowerScript Reference

When a dragged control enters the control

DragLeave in PowerScript Reference

When a dragged control leaves the control

DragWithin in PowerScript Reference

When a dragged control is within the control

DropDown in PowerScript Reference

When the user has clicked the drop-down arrow in a DatePicker control before the drop-down calendar displays

GetFocus in PowerScript Reference

Just before the control receives focus (before it is selected and becomes active)

Help in PowerScript Reference

When the user presses the F1 key or drags the context help button (question mark) from the title bar to a menu item or control

LoseFocus in PowerScript Reference

When the control loses focus (becomes inactive)

Other in PowerScript Reference

When a Controls message occurs that is not a PowerBuilder event

PreCreateWindow

This event is reserved for future use

RButtonDown in PowerScript Reference

When the right mouse button is pressed on the control

UserString in PowerScript Reference

When the user has edited the contents of the control and the control has lost focus

ValueChanged in PowerScript Reference

When the Value property in a DatePicker control changes


Functions

DatePicker function

Datatype returned

Description

ClassName in PowerScript Reference

String

Returns the name assigned to the control

Drag in PowerScript Reference

Integer

Starts or ends the dragging of the control

GetCalendar

Long

This function is reserved for future use

GetContextService in PowerScript Reference

Integer

Creates a reference to a context-specific instance of the specified service

GetParent in PowerScript Reference

PowerObject

Returns a reference to the name of the parent object

GetText in PowerScript Reference

String

Returns the text displayed in the control

GetToday in PowerScript Reference

Date

Returns the date that the calendar uses as today's date

GetValue in PowerScript Reference

Integer

Returns the date and time in the Value property

Hide in PowerScript Reference

Integer

Makes the control invisible

Move in PowerScript Reference

Integer

Moves the control to a specified location

PointerX in PowerScript Reference

Integer

Returns the distance of the pointer from the left edge of the control

PointerY in PowerScript Reference

Integer

Returns the distance of the pointer from the top of the control

PostEvent in PowerScript Reference

Boolean

Adds the specified event to the end of the event queue for the specified object

Print in PowerScript Reference

Integer

Prints the control

Resize in PowerScript Reference

Integer

Changes the size of the control

SetFocus in PowerScript Reference

Integer

Sets focus to the specified control

SetPosition in PowerScript Reference

Integer

Specifies the position of the control in the front-to-back order of the window

SetRedraw in PowerScript Reference

Integer

Controls automatic redrawing of the control after each change in its properties

SetToday in PowerScript Reference

Integer

Sets the value that is used by the calendar as today's date

SetValue in PowerScript Reference

Integer

Sets the date and time in the Value property

Show in PowerScript Reference

Integer

Makes the control visible

TriggerEvent in PowerScript Reference

Integer

Triggers a specified event in the control and executes the script for the event

TypeOf in PowerScript Reference

Object

Returns the type of the control