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.
If a MonthCalendar control supports multi-selection you can select a range of dates in the control. To obtain the maximum number of days in this date range use the wMaxDateRange
property of the Win32MonthCalendar
object. During the test run this object is automatically associated with MonthCalendar controls whose class names are listed in the project’s Object Mapping options. The wMaxDateRange
property returns maximum number of days in the range that can be selected in the MonthCalendar control.
Below is an example that demonstrates how you can use wMaxDateRange
to obtain the maximum date range (in days) that can be selected in the MonthCalendar control:
JavaScript, JScript
function main()
{
var MonthCalendar;
// Obtain the DateTimePicker control
MonthCalendar = Sys.Process("Project1").Window("TForm1", "Form1").Window("TMonthCalendar");
// Get the maximum date range (in days) that can be selected
Log.Message(MonthCalendar.wMaxDateRange);
}
Python
def Main():
# Obtain the DateTimePicker control
MonthCalendar = Sys.Process("Project1").Window("TForm1", "Form1").Window("TMonthCalendar")
# Get the maximum date range (in days) that can be selected
Log.Message(MonthCalendar.wMaxDateRange)
VBScript
Sub main
Dim MonthCalendar
' Obtain the MonthCalendar control
set MonthCalendar= Sys.Process("Project1").Window("TForm1", "Form1").Window("TMonthCalendar")
' Get the maximum date range (in days) that can be selected
Log.Message MonthCalendar.wMaxDateRange
End Sub
DelphiScript
procedure main;
var MonthCalendar;
begin
// Obtain the DateTimePicker control
MonthCalendar := Sys.Process('Project1').Window('TForm1', 'Form1').Window('TMonthCalendar');
// Get the maximum date range (in days) that can be selected
Log.Message(MonthCalendar.wMaxDateRange);
end;
C++Script, C#Script
function main()
{
var MonthCalendar;
// Obtain the DateTimePicker control
MonthCalendar= Sys["Process"]("Project1")["Window"]("TForm1", "Form1")["Window"]("TMonthCalendar");
// Get the maximum date range (in days) that can be selected
Log.Message(MonthCalendar["wMaxDateRange"]);
}
See Also
Working With MonthCalendar Controls in Desktop Windows Applications
wMaxDateRange Property (MonthCalendar Controls)