API Tree

From Flowcode Help
Jump to: navigation, search

Data-tree traversal type routines


Contents


Functions provided for this class

GetValue Gets the value of the given object, if available
GetName Gets the name of the given object
GetPath Gets the full '.' separated name of the given object
GetSubValue Gets the value of a named sub-item of the given object, if available
Traverse Updates the object to step depth-first through the tree
StepNext Updates the object to point to the next (younger) sibling
StepNamedNext Updates the object to point to the next (younger) sibling matching the name
StepNamedIndex Updates the object to point to the Nth next (younger) sibling matching the name
StepLast Updates the object to point to the last (elder) sibling
StepParent Updates the object to point to its parent object
StepRoot Updates the object to point to the root of the tree
StepChildHead Updates the object to point to the head (eldest) child
StepChildTail Updates the object to point to the tail (youngest) child
StepChildPath Updates the object to point to the '.' separated named child path
CountChildren Returns the number of immediate children present for the object
CheckChildren Returns true if the object has children, else false
CountNamedChildren Returns the number of immediate children present for the object
CheckParent Returns true if the object has a parent, else false if it is the root
StepSubHead Updates the object to point to the head (eldest) attribute, if any
StepSubTail Updates the object to point to the tail (youngest) attribute, if any
StepSubName Updates the object to point to the named attribute, if any
GetCopy Creates a copy of the handle and returns the copy


Examples

Here is an example program to step through the components in the current project and count the number of 5mm LEDs in the project.

We begin by initialising the traversal handle to this which is the root of the panel.

We then step through the panel objects using the Tree.Traverse function using this as the root.

The Tree.GetName function allows us to collect the name of the component the handle variable is currently pointing to.

If the name matches the string "led_5mm" then we increment the counter to count the number of LED components.

FC6 Icon.png Tree Traverse Demo


See also

No additional information

Personal tools