UI Overview: 4.6 Using the Visible Classes: Working with Visible Object Trees

Up: GEOS SDK TechDocs | Up | Prev: 4.5 Creating a Visible Object Tree | Next: 5 A UI Example

Working with visible object trees is quite easy and provides immense flexibility to your applications. Entire groups of objects can be added to, removed from, or moved around in the display with a single command. New objects can be created during execution, and others can be destroyed at will.

Sending Messages in the Tree

Often, an object in the visible tree will need to contact its parent or its children. For example, a child that needs to know the state of its parent must be able to find and contact that parent. Likewise, a parent that must notify all its children to redraw themselves must be able to quickly send out the notification.

An object can send a message to its parent by simply specifying @visParent as the message recipient. That same object could also contact all its children by specifying the recipient as @visChildren . The message sent (only with @send since there are multiple destinations) will go to each of the object's children.

If you need more complicated message passing, you can build this into your Vis subclasses. It is not difficult for an object to retrieve the optr of any of its children or of its parent; it can then send the message appropriately. Each recipient can handle it in the same manner, forwarding it on to the next layer of the tree.

VisClass also employs several messages known as "visual upward queries," or "VUP" messages. These travel up the visible tree until they encounter an object of the proper class, where they will be handled.

Altering the Tree

VisClass and VisCompClass can handle messages that retrieve various information about the visible tree. They also have messages for altering the visible tree's structure.


Up: GEOS SDK TechDocs | Up | Prev: 4.5 Creating a Visible Object Tree | Next: 5 A UI Example