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.
To get the minimum and the maximum dates, which can be selected in the MonthCalendar control, use the wMinDate
and wMaxDate
properties of the Win32MonthCalendar
object. TestComplete associates this object with all MonthCalendar controls whose class names are listed in the project’s Object Mapping options. The wMinDate
and wMaxDate
properties return the minimum and the maximum dates that can be set in the MonthCalendar control.
The date, which you set using the wDate
and wEndDate
properties or the SetSelection
action, should be greater than wMin
and less than wMax
, otherwise it will not be set.
The following example demonstrates how you can use these properties:
JavaScript, JScript
function main()
{
var MonthCalendar;
// Obtain the DateTimePicker control
MonthCalendar= Sys.Process("Project1").Window("TForm1", "Form1").Window("TMonthCalendar");
// Get the minimum and the maximum date
Log.Message(MonthCalendar.wMinDate);
Log.Message(MonthCalendar.wMaxDate);
}
Python
def Main():
# Obtain the DateTimePicker control
MonthCalendar= Sys.Process("Project1").Window("TForm1", "Form1").Window("TMonthCalendar")
# Get the minimum and the maximum date
Log.Message(MonthCalendar.wMinDate)
Log.Message(MonthCalendar.wMaxDate)
VBScript
Sub main
Dim MonthCalendar
' Obtain the MonthCalendar control
Set MonthCalendar= Sys.Process("Project1").Window("TForm1", "Form1").Window("TMonthCalendar")
' Get the minimum and the maximum date
Log.Message MonthCalendar.wMinDate
Log.Message MonthCalendar.wMaxDate
End Sub
DelphiScript
procedure main;
var MonthCalendar;
begin
// Obtain the DateTimePicker control
MonthCalendar:= Sys.Process('Project1').Window('TForm1', 'Form1').Window('TMonthCalendar');
// Get the minimum and the maximum date
Log.Message(MonthCalendar.wMinDate);
Log.Message(MonthCalendar.wMaxDate);
end;
C++Script, C#Script
function main()
{
var MonthCalendar;
// Obtain the DateTimePicker control
MonthCalendar= Sys["Process"]("Project1")["Window"]("TForm1", "Form1")["Window"]("TMonthCalendar");
// Get the minimum and the maximum date
Log.Message(MonthCalendar["wMinDate"]);
Log.Message(MonthCalendar["wMaxDate"]);
}
See Also
Working With MonthCalendar Controls in Desktop Windows Applications
wMinDate Property (Calendar Controls)
wMaxDate Property (Calendar Controls)