GEOS SDK TechDocs
|
|
5.2 Adding and Removing
|
5.4 Sending Messages Through the Tree
MSG_VIS_FIND_CHILD, MSG_VIS_FIND_CHILD_AT_POSITION, MSG_VIS_COUNT_CHILDREN, MSG_VIS_FIND_PARENT
When an application manages a visible object tree, it will most likely need to find children, count children, or get the optr of a particular object in the tree.
VisClass
offers four messages to provide this bookkeeping information. These four messages are listed below.
word MSG_VIS_FIND_CHILD(
optr object);
This message returns the zero-based position of the specified child among the parent's children.
Source: Unrestricted.
Destination: Any visible composite object.
Parameters:
object
The optr of the child to be found.
Return: The zero-based position of the child in the parent's child list. (E.g., the first child returns zero, the second child returns one, the third child returns two, etc.) If
object
is not the optr of one of the composite's children, the value -1 will be returned. If sent to a non-composite object, the message will also return -1.
Interception: Unlikely.
optr MSG_VIS_FIND_CHILD_AT_POSITION(
word position);
This message returns the optr of the child occupying the
position
specified among the recipient's children.
Source: Unrestricted.
Destination: Any visible composite object.
Parameters:
position
The zero-based position of the child whose optr is to be returned.
Return: The optr of the child occupying the passed
position
. If no child occupies that position, or if the message is sent to a non-composite object, the retuned value will be NullOptr.
Interception: Unlikely.
word MSG_VIS_COUNT_CHILDREN();
This message returns the number of children the recipient object has. The count is not zero-based; if a composite has five children, this message will return five.
Source: Unrestricted.
Destination: Any visible composite object.
Parameters: None.
Return: The number of children the object has. If the object has no children (includes non-composite objects), the return will be zero.
Interception: Unlikely.
optr MSG_VIS_FIND_PARENT();
This message returns the optr of the recipient's parent composite.
Source: Unrestricted.
Destination: Any visible composite object.
Parameters: None.
Return: The optr of the object's parent composite. If the message is sent to the top node of a visible tree, the return value will be NullOptr.
Interception: Unlikely.
Tips: If you want to send a message to your parent, use the
@visParent
macro defined in the next section.
GEOS SDK TechDocs
|
|
5.2 Adding and Removing
|
5.4 Sending Messages Through the Tree