While testing MonthCalendar controls, you can use specific properties and methods of the corresponding program object to perform certain actions and obtain data stored in controls. You can call these methods and properties from your keyword tests, as well as from scripts. This topic describes how to work with the needed properties and methods from your scripts. However, when testing a control from your keyword test, you can use the same methods and properties calling them from keyword test operations. For more information, see Keyword Tests Basic Operations.
MonthCalendar controls can support multi-selection of dates or not. To determine whether the MonthCalendar control supports multi-selection use the wMultiSelect
property of the Win32MonthCalendar
object which is automatically associated with MonthCalendar controls during the script run. This property returns True, if the month calendar control supports multi-selection. Otherwise - False.
The following example demonstrates how you can determine whether the MonthCalendar control supports multi-selection:
JavaScript, JScript
function main()
{
var MonthCalendar;
// Obtain the DateTimePicker control
MonthCalendar= Sys.Process("Project1").Window("TForm1", "Form1").Window("TMonthCalendar");
// Determine whether the MonthCalendar control supports multi-selection
Log.Message(MonthCalendar.wMultiSelect);
}
Python
def Main():
# Obtain the DateTimePicker control
MonthCalendar= Sys.Process("Project1").Window("TForm1", "Form1").Window("TMonthCalendar")
# Determine whether the MonthCalendar control supports multi-selection
Log.Message(MonthCalendar.wMultiSelect)
VBScript
Sub main
Dim MonthCalendar
' Obtain the MonthCalendar control
Set MonthCalendar= Sys.Process("Project1").Window("TForm1", "Form1").Window("TMonthCalendar")
' Determine whether the MonthCalendar control supports multi-selection
Log.Message MonthCalendar.wMultiSelect
End Sub
DelphiScript
procedure main;
var MonthCalendar;
begin
// Obtain the DateTimePicker control
MonthCalendar:= Sys.Process('Project1').Window('TForm1', 'Form1').Window('TMonthCalendar');
// Determine whether the MonthCalendar control supports multi-selection
Log.Message(MonthCalendar.wMultiSelect);
end;
C++Script, C#Script
function main()
{
var MonthCalendar;
// Obtain the DateTimePicker control
MonthCalendar= Sys["Process"]("Project1")["Window"]("TForm1", "Form1")["Window"]("TMonthCalendar");
// Determine whether the MonthCalendar control supports multi-selection
Log.Message(MonthCalendar["wMultiSelect"]);
}
If the MonthCalendar control supports multi-selection, you can set the range of dates using the wDate
and wEndDate
properties or SetSelection
action (for more information, see Setting MonthCalendar Date).
To obtain the maximum number of days in the date range that can be selected in the MonthCalendar control use the wMaxDateRange
property of the Win32MonthCalendar
object (for detailed information, see Getting Maximum Date Range in MonthCalendar Controls topic).
See Also
Working With MonthCalendar Controls
wMultiSelect Property (MonthCalendar Controls)
wDate Property (Calendar Controls)
wEndDate Property (MonthCalendar Controls)
SetSelection Action (MonthCalendar Controls)
Setting MonthCalendar Date
Getting Maximum Date Range in MonthCalendar Controls