FormTreeItem

A tree item.

Example

form = cf.Form.New("Tree structure")

    -- Prepare input parameter and tree items
   
treeWidget = cf.FormTree.New("Tree")

treeItem1 = cf.FormTreeItem.New("A", FEKO_HOME..[[/shared/Resources/Automation/axisar.png]])
treeItem1:AddChild(cf.FormTreeItem.New("A1"))
treeWidget:AddChild(treeItem1)
treeItem2 = cf.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:

Property List

Expanded
Controls the tree item's expanded state. Setting it expand/collapse only the item. (Read/Write boolean)
Parent
The tree item parent. (Read only FormTreeItem)
Type
The object type string. (Read only string)

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
label(string)
The tree item label.
path(string)
The file path of the icon image.
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.