Difference between revisions of "API Tree"
From Flowcode Help
Jump to navigationJump to search (XML import API changes) |
|||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | <sidebar>API | + | <sidebar>API Contents</sidebar> |
Data-tree traversal type routines | Data-tree traversal type routines | ||
Line 77: | Line 77: | ||
==Examples== | ==Examples== | ||
− | + | ||
+ | Here is an example program to step through the components in the current project and count the number of 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 "LEDMono" then we increment the counter to count the number of LED components. | ||
+ | |||
+ | {{Fcfile|CountComponent.fcfx|Tree Traverse Demo}} | ||
==See also== | ==See also== | ||
''<span style="color:red;">No additional information</span>'' | ''<span style="color:red;">No additional information</span>'' |
Latest revision as of 08:27, 17 October 2024
<sidebar>API Contents</sidebar> Data-tree traversal type routines
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 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 "LEDMono" then we increment the counter to count the number of LED components.
See also
No additional information