Declares an attribute for a window class.
attribute sAttribute,VerifyFunc, GetFunc
Variable | Description |
---|---|
sAttribute | The name of the attribute. STRING. |
VerifyFunc | An identifier specifying the name of the function used to verify the value of this attribute. |
GetFunc | An identifier specifying the name of the function used to get the value of this attribute. |
The attributes associated with a window class are used by the GetEverything and VerifyEverything methods to get and verify information about a window. You can use the attribute keyword in a winclass declaration to declare new attributes for user-defined classes. For a list of the attributes defined for the built-in classes, see the file winclass.inc.
attribute "Contents", VerifyContents, GetContents attribute "Text", VerifyText, GetText attribute "Selected item by text", VerifyValue,GetSelText
To add a new attribute to the DialogBox class that verifies the number of children in the dialog, you can add code like this to your test frame (or other include file):
[-] winclass DialogBox:DialogBox [ ] attribute "Number of children", VerifyNumChild, GetNumChild [ ] [-] integer GetNumChild() [ ] return ListCount (GetChildren ()) // return count of children of dialog [ ] [-] hidecalls VerifyNumChild (integer iExpectedNum) [ ] Verify (GetNumChild (), iExpectedNum, "Child number test")
As this example shows, you use the hidecalls keyword when defining the verification method for the new attribute.
The keyword hidecalls hides the method from the call stack listed in the results. Using hidecalls allows you to update the expected value of the verification method from the results. If you do not use hidecalls in a verification method, the results file will point to the frame file, where the method is defined, instead of to the script. We recommend that you use hidecalls in all verification methods so you can update the expected values. The Number of Children attribute is listed in the Verify Window dialog when you do an attribute verification.