FormTreeItem
A tree item.
Example
form = pf.Form.New("Tree structure") -- Prepare input parameter and tree items treeWidget = pf.FormTree.New("Tree") treeItem1 = pf.FormTreeItem.New("A", FEKO_HOME..[[/shared/Resources/Automation/axisar.png]]) treeItem1:AddChild(pf.FormTreeItem.New("A1")) treeWidget:AddChild(treeItem1) treeItem2 = pf.FormTreeItem.New("B") treeWidget:AddChild(treeItem2) -- Expands the tree item treeItem1.Expanded = true -- Call back function for item selection in the tree. function exampleCallBack() local path = tostring(treeWidget.CurrentSelectedItem) parentItem = treeWidget.CurrentSelectedItem.Parent while ( parentItem ) do path = tostring(parentItem) .. "." .. path parentItem = parentItem.Parent end print(path) end treeWidget:SetCallBack(exampleCallBack) form:Add(treeWidget) -- Run the form and retrieve the user input form:Run()
Usage locations
The FormTreeItem object can be accessed from the following locations:
- Properties
- FormTree object has property CurrentSelectedItem.
- FormTreeItem object has property Parent.
- Static functions
- FormTreeItem object has static function New(string, string).
- FormTreeItem object has static function New(string).
Property List
Method List
- AddChild (item FormTreeItem)
- Adds the given FormTreeItem as a child.
Constructor Function List
- New (label string, path string)
- Create a new tree item with an icon. (Returns a FormTreeItem object.)
- New (label string)
- Create a new tree item. (Returns a FormTreeItem object.)
Property Details
- Expanded
- Controls the tree item's expanded state. Setting it expand/collapse only the item.
- Type
- boolean
- Access
- Read/Write
- Parent
- The tree item parent.
- Type
- FormTreeItem
- Access
- Read only
- Type
- The object type string.
- Type
- string
- Access
- Read only
Method Details
- AddChild (item FormTreeItem)
- Adds the given FormTreeItem as a child.
- Input Parameters
- item(FormTreeItem)
- The child item.
Static Function Details
- New (label string, path string)
- Create a new tree item with an icon.
- Input Parameters
- Return
- FormTreeItem
- The newly created tree item.
- New (label string)
- Create a new tree item.
- Input Parameters
- label(string)
- The tree item label.
- Return
- FormTreeItem
- The newly created tree item.