ClassDefinition object

A ClassDefinition object is a PowerBuilder object that provides information about the class definition of a PowerBuilder object. You can examine a class in a PowerBuilder library or the class associated with an instantiated object.

All the properties are read-only. You cannot change the class definition using the ClassDefinition object. The ClassDefinition object has no events.

The ClassDefinition object lets you check:

Class names are always reported as lowercase, as you see them in the Browser.

NoteGlobal functions and variables Call FindFunctionDefinition to get a ScriptDefinition object describing the global function. Global variables are included in the VariableList array in the ClassDefinition object for the Application object.

Properties

ClassDefinition property

Datatype

Description

Ancestor

ClassDefinition

An object that represents the ancestor class. Ancestor is NULL when the ClassDefinition is describing PowerObject.

Category

TypeCategory

Specifies whether the type is simple, enumerated, or a class or structure. For a class definition, the value is ClassOrStructureType!.

ClassDefinition

PowerObject

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

DataTypeOf

String

The system class name of the object. DataTypeOf is a string representation of a value of the Object enumerated datatype. Values are lowercase with no exclamation point. Sample values include:

  • window

  • string

  • any

  • dropdownlistbox

For objects you have defined, the datatype is the system class from which your object is inherited.

IsAutoinstantiate

Boolean

Indicates whether the class is an autoinstantiated class.

IsStructure

Boolean

Indicates whether the class is a structure.

IsSystemType

Boolean

Indicates whether the class is a system class—that is, one of the classes defined within PowerBuilder as opposed to a class defined in a PBL by a user.

IsVariableLength

Boolean

Specifies whether the datatype has a fixed size. Values are:

  • TRUE – The datatype is variable length, meaning the datatype is a string, any, blob, or unbounded array.

  • FALSE – The datatype is a fixed length.

IsVisualType

Boolean

Indicates whether the class is a visual (displayable) or non-visual type. Values are:

  • TRUE – The class is visual, for example, a window or a control.

  • FALSE – The class is non-visual, for example, a class user object or a simple datatype.

LibraryName

String

The fully qualified name of the library the class was loaded from.

Name

String

The name of the class. For a nested class, the name is returned in the form of libraryEntryName`className.

NestedClassList[ ]

ClassDefinition

An unbounded array of objects representing the nested classes and local structures for the object.

The array is empty if there are no nested classes. Call the UpperBound function to find out the number of nested classes.

ParentClass

ClassDefinition

An object that represents the parent class that this class is nested within. The value is NULL if the class is not a nested class.

ScriptList[ ]

ScriptDefinition

An unbounded array of objects representing the scripts implemented or defined in the collapsed class hierarchy.

The array is empty if there are no scripts. Call the UpperBound function to find out the number of scripts.

VariableList[ ]

Variable Definition

An unbounded array of objects representing the properties or shared variables in the collapsed class hierarchy.

The array is empty if there are no variables. Call the UpperBound function to find out the number of variables.

Functions

ClassDefinition function

Datatype returned

Description

ClassName

String

Returns the class of the object.

FindMatchingFunction

ScriptDefinition

Finds a function that matches the specified name and argument list.

GetContextService

Integer

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

GetParent

PowerObject

Returns a reference to the name of the parent object.

TypeOf

Object

Returns the type of the object.