This functionality is supported only if you are using the Open Agent.
Consider the declarations for the Open and the Save As dialog boxes of the Text Editor application, which each contain exactly the same child windows:
locator "Open" parent TextEditor StaticText FileNameText locator "File Name:" TextField FileName1 locator "File Name:" ListBox FileName2 locator "File Name:" StaticText DirectoriesText locator "Directories:" StaticText PathText locator "#3" ListBox Path locator "#2" StaticText ListFilesOfTypeText locator "List Files of Type:" PopupList ListFilesOfType locator "List Files of Type:" StaticText DrivesText locator "Drives:" PopupList Drives locator "Drives:" PushButton OK locator "OK" PushButton Cancel locator "Cancel" PushButton Network locator "Network"
locator "Save As" parent TextEditor StaticText FileNameText locator "File Name:" TextField FileName1 locator "File Name:" ListBox FileName2 locator "File Name:" StaticText DirectoriesText locator "Directories:" StaticText PathText locator "#3" ListBox Path locator "#2" StaticText ListFilesOfTypeText locator "List Files of Type:" PopupList ListFilesOfType locator "List Files of Type:" StaticText DrivesText locator "Drives:" PopupList Drives locator "Drives:" PushButton OK locator "OK" PushButton Cancel locator "Cancel" PushButton Network locator "Network"
It is not uncommon for an application to have multiple dialogs whose only difference is the caption: The child windows are all identical or nearly identical. Rather than recording declarations that repeat the same child objects, it is cleaner to create a new class that groups the common child objects.
For example, here is the class declaration for a new class called FileDialog, which is derived from the DialogBox class and declares each of the children that will be inherited by the SaveAs and Open dialog boxes:
winclass FileDialog : DialogBox parent TextEditor StaticText FileNameText locator "File Name:" TextField FileName1 locator "File Name:" ListBox FileName2 locator "File Name:" StaticText DirectoriesText locator "Directories:" StaticText PathText locator "#3" ListBox Path locator "#2" StaticText ListFilesOfTypeText locator "List Files of Type:" PopupList ListFilesOfType locator "List Files of Type:" StaticText DrivesText locator "Drives:" PopupList Drives locator "Drives:" PushButton OK locator "OK" PushButton Cancel locator "Cancel" PushButton Network locator "Network"
To make use of this new class, you must do the following:
Here are the rewritten declarations for the Open and Save As dialog boxes:
window FileDialog SaveAs locator "Save As" window FileDialog Open locator "Open"
For more information on the syntax used in declaring new classes, see the winclass declaration.
The default behavior of Silk Test Classic is to tag all instances of the parent class as the new class. So, if you record a window declaration against a standard object from which you have defined a new class, Silk Test Classic records that standard object’s class as the new class. To have all instances declared by default as the original class, add the following statement to the declaration of your new class: setting DontInheritClassTag = TRUE. For example, let’s say you define a new class called FileDialog and derive it from the DialogBox class. Then you record a window declaration against a dialog box. Silk Test Classic records the dialog box to be of the new FileDialog class, instead of the DialogBox class. To have Silk Test Classic declare the class of the dialog box as DialogBox, in the FileDialog definition, set DontInheritClassTag to TRUE. For example:
winclass FileDialog : DialogBox setting DontInheritClassTag = TRUE