Using class user objects
How you insert a nonvisual
object
There are two ways to use a class user object when the user
object is not autoinstantiating: you can create an instance of it in a
script, or you can insert the user object in a window or user object
using the Insert menu.
For more information on autoinstantiation, see Using AutoInstantiate.
The nonvisual object you insert can be a custom class user
object or a standard class user object of most types.
To instantiate a class user object
-
In the window or user object in which you want to use the
class user object, declare a variable of the user object type and
create an instance of it using the CREATE statement. For
example:123// declared instance variable:// n_myobject invo_myobjectinvo_myobject = CREATE n_myobject -
Use the user object’s properties and functions to do the
required processing. -
When you have finished using the user object, destroy it
using the DESTROY statement.If you select Autoinstantiate in the properties of the class
user object, you cannot use the CREATE and DESTROY
statements.
To insert a class user object
-
Open the window or user object in which you want to insert
the class user object. -
Select Insert>Object from the menu bar.
-
Select User Object (at the bottom of the list) and then
select the class user object you want to insert.PowerBuilder inserts the selected class user object.
-
Modify the properties and code the events of the nonvisual
object as needed.When the user object is created in an application, the
nonvisual object it contains is created automatically. When the
user object is destroyed, the nonvisual object is destroyed
automatically.
Using the Non-Visual Object List
view
You can use the same technique to insert standard class user
objects. Since all class user objects are nonvisual, you cannot see
them, but if you look at the Non-Visual Object List view, you see all
the class user objects that exist in your user object.
Using the Non-Visual Object List view’s pop-up menu, you can
display a class user object’s properties in the Properties view,
display the Script view for the object to code its behavior, or delete
the object.