6.6. XView Convenience API

[Important]XView-specific

The XView Convenience API is only available for the Squish for XView editions.

Here are some quick links to the XView Convenience API's functions:

activateItem(objectName, itemText);

This function activates the menu item with the specified itemText in the menu identified by the given objectName.

clickItem(object, x, y, state, button, action);

This function sends a mouse click at position x and y (in the object item's coordinates) to the panel item (such as a button, choice item, etc.) with the button button, modifier state state and action action of the panel referenced by the object.

closeFrame(frame);

This function closes (hides) the frame called frame.

closeNotice(button, result);

This function closes the currently open notice (if one is open) using the specified button so that it returns the specified result.

Object findItem(itemName);

This function finds and returns a reference to a panel item given its fully qualified name itemName.

installEventHandler(eventName, handlerFunctionNameOrReference);

This function installs a global event handler. The script function named or referenced in handlerFunctionNameOrReference, will be called when an event of the eventName type occurs.

The eventName can be any of the following event types:

The function name passed as the handlerFunctionName is called with a single argument—the object on which the event occurred.

[Note]Python-specific

In Python scripts, you can specify the callback function to invoke by passing an actual function or a lambda function.

For examples see How to Use Event Handlers (Section 5.10).

[Important]The AUT Must be Running

The installEventHandler function will only work if it is called after the AUT has been started (e.g., using the startApplication function).

Boolean isNoticeOpen();

This function returns a true value if a notice is currently open; otherwise it returns a false value.

String lastNoticeMessage();

This function returns the text of the last opened message.

openFrame(frame);

This function opens (shows) the frame called frame.

sendEvent(eventName, receiverObjectOrName, ...);

This function sends an event of type eventName to the receiverObjectOrName (i.e., to the given object or to the object identified by the given name). Any additional arguments are used to initialize the event that is sent (e.g., coordinates, button states, etc).

The following eventNames are supported:

type(object, text);

This function sends key events to the editable panel item object to enter the given text as if the user had typed the text at the keyboard. The input is case-sensitive, so type(object, "R") is different from type(object, "r").

uninstallEventHandler(eventName, handlerFunctionNameOrReference);

This function uninstalls an event handler that has been previously installed using installEventHandler.