background image
<< Porting Tests - Creating a class that maps to several SilkTest classes | Porting Tests - Supporting differences in application behavior >>
Porting Tests - Changing the window declaration of the control
<< Porting Tests - Creating a class that maps to several SilkTest classes | Porting Tests - Supporting differences in application behavior >>
276
User's Guide
13 P
ORTING
T
ESTS
TO
O
THER
GUI
S
Supporting different implementations of the same control
default
RadioList (WndTag).Select (Item)
Note the following:
·
The Select method acts against the control, regardless of whether it is a
RadioList or CheckBox. The method contains a switch statement which
executes the SetState method if the control is a check box, and the Select
method if the control is a radio list.
Note The Select method also takes an optional parameter, as
indicated by the keyword optional. For more information, see
"Functional declaration" in online Help.
·
Because the tag of the object will differ on each GUI, rather than
specifying an identifier in the SetState and Select method calls, you use
the WndTag property. By doing this, you force SilkTest to construct a
dynamic identifier for the object at runtime which will uniquely identify
the object as a check box in the Macintosh case and as a radio list in all
other cases.
Changing the window
declaration of the
control
The next step is to change your window declarations so that the control has
the new class.
Continuing the example from the last section, you change the class of the
control named Direction to DirButton.
window DialogBox Find
tag "Find"
parent TextEditor
DirButton Direction
tag "Direction"
Using cross-platform
methods in your
scripts
Finally, in your scripts, you can use your cross-platform method names. The
window declarations map the cross-platform method names you use in your
scripts to the actual methods required to carry out the actions you want on
each of the GUIs.
Continuing the example from the last section, you use the Select method in
your code to select the control named Direction.
testcase SearchBackward ()
LISTITEM Item
Item = "Up"
Find.Invoke ()
Find.Direction.Select (Item)
.
.