ScriptDefinition object

Information about a script associated with a class definition. ScriptDefinition is used in the ClassDefinition object.

You cannot instantiate a ScriptDefinition object for a particular script independently of a ClassDefinition object. Instead you access the ScriptDefinition instances that are elements of the ScriptList array of a ClassDefinition instance.

The ScriptDefinition object has information about:

  • The script's name and whether it is a function or an event

  • The return type, arguments, and local variables

  • The source code

  • Whether the script is defined locally or in an ancestor

  • External function declarations

A ScriptDefinition object has no events.

Properties

ScriptDefinition property

Datatype

Description

Access

VarAccess

The access level of the script (what objects can call the script). Values are:

Private!

Public!

Protected!

System!

AliasName

String

The alias value for an external function. The value is an empty string ("") for scripts that are not aliased external functions. Corresponds to the ALIAS FOR keyword in the external function declaration.

ArgumentList

VariableDefinition

An unbounded array whose elements are VariableDefinition objects, one object per argument. The array is empty if there are no arguments.

ClassDefinition

PowerObject

An object of type PowerObject containing information about the class definition of the object or control.

EventId

Long

The numeric event ID for an event. For events that do not have an ID, the value is -1.

EventIdName

String

The event ID name for an event. For events that do not have an ID, the value is an empty string ("").

ExternalUserFunction

String

The file name of the DLL containing the external user function. The value is an empty string ("") for scripts that are not external user functions. Corresponds to the LIBRARY keyword in the external function declaration.

IsExternalEvent

Boolean

Indicates whether this is an external event. External events are automatically generated events that get dispatched elsewhere.

IsLocallyDefined

Boolean

Indicates whether the event is defined at this level in the inheritance hierarchy. Values are:

TRUE  -- The event is defined at this level of the object's inheritance hierarchy.

FALSE -- The event is defined at an ancestor level.

IsLocallyDefined is not applicable to functions.

IsLocallyScripted

Boolean

Indicates whether the script is implemented at this level in the inheritance hierarchy. Values are:

TRUE  -- There is code for the event or function at this level of the object's inheritance hierarchy.

FALSE  -- There is no code for the event or function at this level.

IsRPCFunction

Boolean

Whether this is an RPC function. Values are:

TRUE -- Is an RPC function.

FALSE -- Is not an RPC function.

Corresponds to the RPCFUNC keyword in a declaration for a stored procedure.

IsScripted

Boolean

Whether the event has a definition but no code at any level of the collapsed inheritance hierarchy. Values are:

TRUE  -- The event has a script at some level of the object's inheritance hierarchy.

FALSE -- The event does not have a script.

Only events can be defined but not scripted. For functions, IsScripted is always true.

Kind

ScriptKind

Whether the script is a function or event. Values are:

ScriptEvent!

ScriptFunction!

LocalVariableList

VariableDefinition

An unbounded array whose elements are VariableDefinition objects, one object per local variable. The array is empty if there are no local variables.

Name

String

The name of the script.

ReturnType

TypeDefinition

The type information of the return value. For scripts that do not return anything, ReturnType is an invalid object. Use the IsValid function to test the value.

Source

String

The source code for the script. Source is an empty string ("") if the source is not available (for example, when running an executable).

SystemFunction

String

For built-in PowerBuilder functions, the file name of the DLL containing the function. The value is an empty string ("") for scripts that are not built-in PowerBuilder functions.


Functions

ScriptDefinition function

Datatype returned

Description

ClassName in PowerScript Reference

String

Returns the name assigned to the object.

GetContextService in PowerScript Reference

Integer

Creates a reference to a context-specific instance of the specified service.

GetParent in PowerScript Reference

PowerObject

Returns a reference to the name of the parent object.

TypeOf in PowerScript Reference

Object

Returns the type of the object.