Top
PowerCOBOL V11.0 User's Guide
FUJITSU Software

9.7.2 Accessing Objects Using Class Object References

In certain situations you may want the same code to access different objects, or you may find it more convenient to refer to an object reference rather than the fully qualified PowerCOBOL syntax format (e.g. "Child" (n) OF "Child" (m) OF "Root" (p) OF TreeView1). To enable you to do this PowerCOBOL provides classes for the objects as listed in Table 9.1 below.

Table 9.1 PowerCOBOL Classes for PowerCOBOL Objects

Object

Class Name

Column

POW-CCOLUMN

Font

POW-CFONT

ListItem

POW-CLISTITEM

Node

POW-CNODE

Others

POW-COBJECT

To use one of these classes you set up a USAGE OBJECT REFERENCE item in WORKING-STORAGE and MOVE the object to that item. For example, to set up a data item NODE1 to store the object reference for a TreeView node you could code:

  01 NODE1 USAGE IS OBJECT REFERENCE POW-CNODE.
  ...
     MOVE "Root" (2) OF TreeView1 TO NODE1

You can use the object reference, NODE1, wherever you would use the fuller syntax '"Root" (2) OF TreeView1'. For example, you can set properties, or reference child nodes:

     MOVE "NODE-NAME" TO "Text" OF NODE1.
     MOVE "Child" (3) OF NODE1 TO NODE2.

See the TreeView sample program for examples of using object references.