IsOfClass Function

Class

  • AnyWin
  • AgentClass
  • ClipboardClass
  • CursorClass

Action

Tests whether an object is of the specified class.

Syntax

bTest = object.IsOfClass(dClass,[bExact])
Variable Description
bTest TRUE if the object is of the specified class. BOOLEAN.
dClass The class to test for. DATACLASS.
bExact Optional: If set to TRUE, IsOfClass returns TRUE when dClass is exactly the same as the object’s class. If set to FALSE or omitted, IsOfClass returns TRUE when dClass is either a parent of the object’s class or matches exactly.

Use IsOfClass to test whether a variable of type WINDOW holds a window of a particular class. In the example below, if the active window returned to wWin is of MessageBoxClass, IsOfClass will return TRUE. IsOfClass is the method equivalent of the function WindowIsOfClass.

Example

[ ] // in declarations
[-] window MessageBoxClass MessageBox
	[ ] tag "~ActiveApp/[DialogBox]$MessageBox"
	[ ] ...
[-] window DialogBox Find
	[ ] tag "Find"
	[ ] parent NotePad
	[ ] ...
[ ] 
[ ] // in testcase script
[-] WINDOW wWin = NotePad.GetActive()
	[ ] ...
[ ] BOOLEAN bTest = wWin.IsOfClass(MessageBoxClass, TRUE)