VisClass: 5.1 Working with Visible Object Trees: Creating and Destroying

Up: GEOS SDK TechDocs | Up | Prev: 5 Working with Visible Object Trees | Next: 5.2 Adding and Removing
MSG_VIS_DESTROY

Visible objects are just like any other objects in the ways they are created and destroyed. You can create visible objects in many ways; the easiest is to set them up in a resource and simply load or duplicate the resource block at run-time. You can also use the ObjInstantiate() routine to instantiate new visible objects on the fly from your predefined subclass of VisClass , VisCompClass , or VisContentClass . the GEOS Programming chapter details how to instantiate a new object of a given class.

Destroying visible objects is very simple. You only need to use the message MSG_VIS_DESTROY , which works on a visible object and all its children (if it has any). This message removes the visible branch from the screen if necessary, detaches the visible objects from the visible tree, and then destroys the object (freeing its instance chunk). The only thing the object must do is clean up after itself--in its MSG_META_DETACH or MSG_META_FINAL_OBJ_FREE handler, it should free any memory that it allocated explicitly for its own use, for example.

MSG_VIS_DESTROY also marks the destroyed object's parent invalid both in geometry and image so the tree will be updated properly.

MSG_VIS_DESTROY

void	MSG_VIS_DESTROY(
        VisUpdateMode updateMode);

This message is the high level routine for destroying branches of visible trees. This message will close and destroy the entire branch, unlinking any visible objects in the branch under the recipient object. The parent of the removed branch will be marked invalid for later visual update. This message may be subclassed to replace the geometry update handling, but this is not easily done and is rare.

Source: Unrestricted.

Destination: Any visible object (or head of a visible branch).

Parameters: updateMode A VisUpdateMode that determines when the visible parent of the destroyed object/branch will be updated on the screen.

Return: Nothing.

Interception: Unlikely--may be subclassed if the parent is not to be marked invalid. This is extremely rare.


Up: GEOS SDK TechDocs | Up | Prev: 5 Working with Visible Object Trees | Next: 5.2 Adding and Removing