VariableDefinition object

A class describing the characteristics of a variable, property, or argument. VariableDefinition is used as a property in the ClassDefinition and ScriptDefinition objects. It has no events.

You cannot start with a variable in your application and get a VariableDefinition object for it. Instead, you access the VariableDefinition instances that are elements of the VariableList array of a ClassDefinition instance or the ArgumentList array of a ScriptDefinition instance.

The VariableDefinition object has information about:

  • The variable's name and type

  • Whether the variable is a scalar or an array and information about the array

  • The variable's initial value, whether the value overrides an ancestor's value, and whether the variable is a constant

  • The read and write access levels for the variable

  • The scope of the variable (global, shared, instance, local, argument), including whether the variable is an argument and how the argument is passed

Properties

VariableDefinition property

Datatype

Description

CallingConvention

ArgCallingConvention

The way an argument is passed when Kind is VariableArgument! Values are:

ByReferenceArgument!

ByValueArgument!

ReadOnlyArgument!

VarListArgument!

VarListArgument! applies only to arguments for built-in PowerBuilder functions. They are shown as ellipses in the Browser. For an example, see the section called “ImportString” in DataWindow Reference.

Cardinality

VariableCardinalityDefinition

Cardinality information for the variable.

ClassDefinition

PowerObject

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

InitialValue

Any

The initial value of the variable. Not valid when Kind is VariableArgument!.

IsConstant

Boolean

Indicates whether the variable is a constant. Not valid when Kind is VariableArgument!.

IsControl

Boolean

Indicates whether the variable is a control defined as a nested class within its parent, rather than an instance variable with a control class as its datatype. Valid only when Kind is VariableInstance!.

IsUserDefined

Boolean

Indicates whether the variable is a user-defined variable, instead of a property or variable defined by PowerBuilder.

Always true for local variables. True for arguments if the function was also user-defined.

Kind

VariableKind

The scope of the variable. Values are:

VariableGlobal!

VariableShared!

VariableInstance!

VariableArgument!

VariableLocal!

Global variables are found only in the Application object. Argument and local variables are found only in scripts.

Name

String

The name of the variable.

OverridesAncestorValue

Boolean

Indicates whether the current initial value overrides an ancestor's initial value. Valid only when Kind is VariableInstance!

ReadAccess

VarAccess

The read access to the variable. Values are:

Private!

Public!

Protected!

System!

Not valid when Kind is VariableArgument! or VariableLocal!

TypeInfo

TypeDefinition

Type information for the variable.

WriteAccess

VarAccess

The write access to the variable. Values are:

Private!

Public!

Protected!

System!

Not valid for VariableArgument! or VariableLocal!


Functions

VariableDefinition 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