IsDefined Function

Class

AnyWin class.

Action

Tests whether or not a specified definition exists.

Syntax

bDefined = window.IsDefined(sName, [Class, wdhDefinedHow])
Variable Description
bDefined TRUE if the definition exists. BOOLEAN.
sName The name of the definition to look for. STRING.
wcClass Optional: The window class of sName if it is defined by the window’s class. NULL if sName is defined by the window or not defined. out DATACLASS.
wdhDefinedHow

Optional: Specify DEFINED_METHOD to have IsDefined look for a method, DEFINED_NOT_METHOD to look for another type of definition, for example a property or member, or DEFINED_ANY to look for any definition.

See WINDOWDEFINEDHOW Data Type.

Notes

IsDefined returns TRUE if the specified definition exists in the declaration for the window, or FALSE if it is not defined. IsDefined is useful when you want to check that a method that you would like to call explicitly is actually defined. At other times, you might want to pass sName, if it exists, as an argument to a function or method. Use a NULL argument to omit the first optional parameter.

Example

Print(TextEditor.IsDefined("File")) //prints TRUE for File menu
Print("Defined as Method: ", TestApp.IsDefined("Close", NULL, DEFINED_METHOD)) //prints Defined as Method: TRUE
Print("Not Defined as Method: ", TestApp.IsDefined("Close", NULL, DEFINED_NOT_METHOD)) //prints Not Defined as Method: FALSE
Print("Is It Defined: ", TestApp.IsDefined("Close", NULL, DEFINED_ANY)) //prints Is It Defined: TRUE