MonthCalendar
MonthCalendar
The MonthCalendar provides a full-featured calendar interface that remains permanently on the screen, allowing operators to view and select dates.
While the DateTimePicker object offers a compact selection in a single line, the MonthCalendar object occupies a larger area and provides a much more visual experience.
The most important feature of the MonthCalendar is that it allows the operator to select either a single date or a range of dates (e.g., November 10th – November 15th) by dragging the mouse.
Common Use Cases
- Reporting Range: Selecting both a “Start Date” and “End Date” for a report from a single interface.
- Production Planning: Visually selecting the week a work order will start or complete.
- Historical Data: Determining the date range to query when examining trend or alarm records.
Basic Configuration and Operation
1. Setting the Selection Mode (Advanced Panel) The object’s primary behavior is determined by the MaxSelectionCount property in the Advanced panel.
- If MaxSelectionCount = 1, the calendar allows only a single day to be selected.
- If MaxSelectionCount = 7, the operator is allowed to select a range of up to 7 days (one week) using the mouse.
2. Binding Values (Properties Panel) The date or date range selected by the operator is linked to SCADA tags via the Value section in the Properties panel.
Properties Panel – Key Properties
Value
- Start
- Function: A two-way link connecting the first day of the operator’s selected date range to a DateTime tag.
- Read: If the linked tag (e.g., Report_Start_Tag) is changed by a script, the selection in the calendar jumps to that date.
- Write: If the operator selects November 10th, the Report_Start_Tag receives the value “10.11.2025”.
- End
- Function: A two-way link connecting the last day of the selected range to a DateTime tag.
- Note: If MaxSelectionCount = 1 (single day selection only), Start and End will always receive the same value.
Advanced Panel – Key Properties
- MaxSelectionCount
- Determines the maximum number of days the operator can select by dragging the mouse. Values like 7 (weekly) or 30 (monthly) are commonly used for reporting.
- MinDate / MaxDate
- Similar to the DateTimePicker, these restrict the earliest and latest dates the operator can select.
- CalendarDimensions
- Determines how many months are displayed on the screen simultaneously (Width x Height).
- Example: If set to Width = 3, Height = 1, the calendar displays 3 months (e.g., October, November, December) side-by-side.
- ShowToday
- Determines whether information like “Today: 11 November 2025” is displayed at the bottom of the calendar (True/False).
- ShowTodayCircle
- If set to True, displays a circle (or highlight) around the current date.
- AnnuallyBoldedDates / MonthlyBoldedDates
- Used to mark specific dates in bold on the calendar.
- Use Case: Highlighting static maintenance dates (e.g., adding “01.01.2025” to AnnuallyBoldedDates for the New Year holiday) or periodic maintenance days (e.g., adding the 15th of the month to MonthlyBoldedDates to highlight the 15th of every month).
Common Usage Examples
Example: Selecting a Date Range for a Report
- Add a MonthCalendar to the screen.
- Go to the Advanced panel:
- MaxSelectionCount: 7 (Allow the user to pull a report for a maximum of 7 days).
- CalendarDimensions: Width = 2, Height = 1 (Display two months side-by-side).
- Go to the Properties panel and configure the Value section:
- Bind SelectionStart -> Report_Start_Time (DATETIME) tag.
- Bind SelectionEnd -> Report_End_Time (DATETIME) tag.
- Add a button (“Get Report”) to the screen. Configure its Mouse Down event to trigger a script that reads these two tags and populates a DataGridView.
Result: When the operator selects the range from November 10th to November 13th on the calendar, Report_Start_Time becomes “10.11.2025” and Report_End_Time becomes “13.11.2025”. Pressing the “Get Report” button retrieves data within this range.
