(umonthcalendar) MonthCalendar

The umonthcalendar widget displays a month calendar to enable the user to select a date. Uniface provides a logical widget called MonthCalendar, which is mapped to umonthcalendar.

MonthCalendar widget

For more information, see Specifying a Widget for a Field or Entity.

Widget Overview
Logical widget name: MonthCalendar
Maps to physical widget:

umonthcalendar

Default definition: MonthCalendar=umonthcalendar
Use for: String fields (not Date)
Supported triggers: See Triggers
Supported properties: See Widget Properties
Supported in egrid(Grid) widget? No
Supports MSAA? : No

Description

The umonthcalendar widget implements a calendar-like user interface that enables the user to easily enter a date. It also enables the application to obtain and set the date information in the control using existing data types. It wraps the Microsoft Windows Calendar control.

You can use the widget with fields that have a value of type String in the format yyyymmdd. The widget cannot be used if the field uses layout shorthand codes for dates or if the windows control does not accept years before 1752 and beyond 9999. For example, if you use the field layout code DIS (dd-MMM-yyyy) with the calendar widget, the date is not changed.

If the field value is empty, the widget shows the current date at the bottom of the widget, but also displays a message to Select a date.

The user can enter a date by selecting it in the control:

  • To select the year, click the header. This activates a spin button to select the year.
  • To select the month, click the header. This activates a drop-down list of months.
  • To select the day, click the date in the calendar

Language and Date-Time Formats

The umonthcalendar widget uses the Windows Regional and Language options to determine the language used for the name of the month and day of the week, and the format of Today's Date. The value of $LANGUAGE or Language Setups have no effect on these properties. However, they can be used to control the language of the following messages:

  • 4800 - Select a date.
  • 4801 - Date was out of range.

Use $text to provide language-specific version of these messages.

Triggers

Widget Properties

Month Calendar Properties

Property

Technical Name

Dynamic?

3-D Effect (3d)

3D

No

Attach to Window Border (attach)

Attach

Yes

Background Color (BackColor)

Background Color (BackColor)

BackColor

Yes

Month Background Color (MonthBackColor)

MonthBackColor

Yes

Circle Today's Date

TodayCircle

Yes

First Day of Week (FirstDayOfWeek)

FirstDayOfWeek

Yes

Foreground Color (ForeColor)

ForeColor

Yes

Frame

Frame

No

Label Font (LabelFont)

LabelFont

No

Show Today's Date (Today)

Today

Yes

Title Background Color (TitleBackColor)

TitleBackColor

Yes

Title Foreground Color (TitleForeColor)

TitleForeColor

Yes

Trailing Foreground Color (TrailingForeColor)

TrailingForeColor

Yes

Show Week Numbers

WeekNumbers

No

Widget Font (Font)

Font

Yes

Attach Margin (AttachMargin)

AttachMArgin

Yes

Popup Rectangle (PopupRect)

PopupRect

Yes

Colors in Calendars

Note:  Changes to widget font and color settings in the umonthcalendar are supported only in Windows Classic mode. They cannot be applied when Windows visual styles are in effect, for example when a theme is applied, or in Windows 8 or higher.

The umonthcalendar widget supports the standard Uniface field colors, including true colors. You can use functions such as $fieldvideo and $currocvideo to define the colors. The colors defined with these functions are applied to the background color displayed between months, and the color used to display text within a month. The color can be overwritten with the widget's color properties, such as Background Color, Foreground Color, Month Background Color, and so on.

For example, the following code sets the calendar widget to a steel blue.

$fieldproperties(FIELD)= "backcolor=lightsteelblue4; monthbackcolor=lightsteelblue;titlebackcolor=lightsteelblue1; titleforecolor=lightslategray; trailingforecolor=lightyellow2; forecolor=black"

Graphical content.

In the following example, $date gives the current date in yyyymmdd format, assigning it directly to the calendar widget..

Date = $date