(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
.
For more information, see Specifying a Widget for a Field or Entity.
Logical widget name: | MonthCalendar |
Maps to physical widget: |
|
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
- trigger startModification—when changing the date
- trigger valueChanged—when leaving the field after changing the date in the calendar
Widget Properties
Property |
Technical Name |
Dynamic? |
---|---|---|
3D |
No |
|
Attach |
Yes |
|
BackColor |
Yes |
|
MonthBackColor |
Yes |
|
TodayCircle |
Yes |
|
FirstDayOfWeek |
Yes |
|
ForeColor |
Yes |
|
Frame |
No |
|
LabelFont |
No |
|
Today |
Yes |
|
TitleBackColor |
Yes |
|
TitleForeColor |
Yes |
|
TrailingForeColor |
Yes |
|
WeekNumbers |
No |
|
Font |
Yes |
|
AttachMArgin |
Yes |
|
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"
In the following example, $date
gives the current date in yyyymmdd
format, assigning it directly to the calendar
widget..
Date = $date