SWTDateTime Class

Description

SWTDateTime is the class for SWT date and time elements in a calendar, date, or time control.

Availability

This class is supported only on the Open Agent.

Inheritance

SWTDateTime is derived from the Control class; no classes derive from this class.

Identification of Date Time Controls

SWTDateTime appends a 1, 2, or 3 to the class name to indicate which type of control is selected:

  • 1 (SWTDateTime1) - Calendar control with two buttons (previous month, next month)

  • 2 (SWTDateTime2) - Date control with spin buttons (up, down)

  • 3 (SWTDateTime3) -Time control with spin buttons (up, down)

Example

The following example uses the various properties of the control.

[-] testcase TestGetCurrent()  appstate none
      [-] do
// Set the CurrentDate
            [ ] SWTControls.PageList1.Control22.DateTimeControls.SWTDateTime3.CurrentDate = "2008-10-05 09:15:45"
            [ ] Verify(SWTControls.PageList1.Control22.DateTimeControls.SWTDateTime3.Year, 2008, "  year")
            [ ] Verify(SWTControls.PageList1.Control22.DateTimeControls.SWTDateTime3.Month, OCTOBER, " month")
            [ ] Verify(SWTControls.PageList1.Control22.DateTimeControls.SWTDateTime3.Day, 5, " day")
            [ ] Verify(SWTControls.PageList1.Control22.DateTimeControls.SWTDateTime3.Hours, 9, " hours")
            [ ] Verify(SWTControls.PageList1.Control22.DateTimeControls.SWTDateTime3.Minutes, 15, " minutes")
            [ ] Verify(SWTControls.PageList1.Control22.DateTimeControls.SWTDateTime3.Seconds, 45, " seconds")
            [ ] DateTime dt = SWTControls.PageList1.Control22.DateTimeControls.SWTDateTime3.CurrentDate
            [ ] Print(dt)
      [-] except
            [ ] Print(ExceptData())

Methods and Properties

In addition to the methods and properties it inherits from the AnyWin and Control classes, SWTDateTime has the following methods and properties: