Overview of class definition information
A ClassDefinition object is a PowerBuilder object that provides
information about the class of another PowerBuilder object. You can
examine a class in a PowerBuilder library or the class of an instantiated
object. By examining the properties of its ClassDefinition object,
you can get details about how that class fits in the PowerBuilder object
From the ClassDefinition object, you can learn:
- The variables, functions,
and events defined for the class
- The class’s ancestor
- The class’s parent
- The class’s children (nested classes)
Related objects The ClassDefinition object is a member of a hierarchy of objects,
including the TypeDefinition, VariableDefinition, and ScriptDefinition
objects, that provide information about data types or about the
variables, properties, functions, and event scripts associated with
a class definition.
For more information, see the Browser or Objects
Definitions for instantiated objects For each object instance, a ClassDefinition property makes
available a ClassDefinition object to describe its definition. The
ClassDefinition object does not provide information about the object
instance, such as values of its variables. You get that information
by addressing the instance directly.
Definitions for objects in libraries An object does not have to be instantiated to get class information.
For an object in a PowerBuilder library, you can call the FindClassDefinition
function to get its ClassDefinition object.
Performance Class definition objects may seem to add a lot of overhead,
but the overhead is only incurred when you refer to the ClassDefinition
object. The ClassDefinition object is only instantiated when you
call FindClassDefinition or access the ClassDefinition property
of a PowerBuilder object. Likewise, for properties of the ClassDefinition
object that are themselves ClassDefinition or VariableDefinition
objects, the objects are only instantiated when you refer to those
The class information includes information about the relationships
between objects. These definitions will help you understand what
the information means.
A realization of an object. The instance exists in memory
and has values assigned to its properties and variables. Object
instances exist only when you run an application.
A definition of an object, containing the source code for
creating an object instance. When you use PowerBuilder painters and
save an object in a PBL, you are creating class definitions for
objects. When you run your application, the class is the data type
of object instances based on that class.
In PowerBuilder, the term object
refers to an instance of the object. It sometimes refers to an object’s
A class defined by PowerBuilder. An object you define in a painter
is a descendant of a system class, even when you don’t
explicitly choose to use inheritance for the object you define.
The object that contains the current object or is connected
to the object in a way other than inheritance. This table lists
classes and the classes that can be their parent:
|Window||The window that opened the window. A
window may not have a parent. The parent is determined during execution
and is not part of the class definition
|Menu item||The menu item on the prior level in the
menu. The item on the menu bar is the parent of all the items on the
associated dropdown menu
|Control on a window||The window|
|Control on user object||The user object|
|TabPage||The Tab control in which it is defined
or in which it was opened
|ListViewItem or TreeViewItem||The ListView or TreeView control|
|Visual user object||The window or user object on which the
user object is placed
A class that is contained within another parent class. Also
called a nested class. For the types of objects that have a parent
and child relationship, see parent.
A child class.
A class from whose definition another object is inherited.
See also descendant.
An object that is inherited from another object and that incorporates
the specifics of that object: its properties, functions, events,
and variables. The descendant can use these values or override them
with new definitions.
All objects you define in painters and store in libraries
are descendants of PowerBuilder system classes.
An object and all its ancestors.
A view of an object class definition that includes information
from all the ancestors in the object’s inheritance tree,
not just items defined at the current level of inheritance.
A simple data type that is not an object or an array. For
example, integer, boolean, date, any, string.
instance variable and property
Built-in properties of PowerBuilder system objects are called
properties, but they and the instance variables you define are both
treated as instance variables in the class definition information.
Who uses PowerBuilder classdefinitions
Most business applications will not need to use class definition
Code that uses class definition information is written by
groups that write class libraries, application frameworks, and productivity
Although your application may not include any code that uses
class definition information, tools that you use for design, documentation,
and class libraries will. These tools examine class definitions
for your objects so that they can analyze your application and provide
feedback to you.
Scenarios Class information might be used when developing:
- A custom object browser.
- A tool that needs to know the objects of an application
and their relationships. The purpose may be to document the application
or to provide a logical way to select and work with the objects.
- A CASE tool that deconstructs PowerBuilder objects,
allows the user to redesign them, and reconstructs them. To do the
reconstruction, the CASE tool needs both class definition information
plus a knowledge of PowerBuilder object source code syntax.
- A class library in which:
- Objects need to determine
the class associated with an instantiated object
- A script needs to know the ancestor of an object
in order to make assumptions about available methods and variables
- Objects need to determine