FormTree

A tree.

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()

Inheritance

The FormTree object is derived from the FormItem object.

Property List

CurrentSelectedItem
The current selected tree item. (Read/Write FormTreeItem)
Enabled
Controls the item enabled state. Setting the enabled state of an item to false will also disable items or their contents. (Read/Write boolean)
FixedHeight
The fixed height of the item in pixels. When the fixed height is set to a positive value, it is the height of the item. Setting the fixed height to zero or a negative value will restore the default/auto setting and the height will be dynamically determined. The fixed height takes precedence over the minimum height and thus the minimum height is ignored when a fixed height is set. (Read/Write number)
FixedWidth
The fixed width of the item in pixels. When the fixed width is set to a positive value, it is the width of the item. Setting the fixed width to zero or a negative value will restore the default/auto setting and the width will be dynamically determined. The fixed width takes precedence over the minimum width and thus the minimum width is ignored when a fixed width is set. (Read/Write number)
ItemHeight
The height of the item in pixels. (Read only number)
ItemWidth
The width of the item in pixels. (Read only number)
MinimumHeight
The minimum height of the item in pixels. When the height is dynamically determined, it will not be less than the minimum height setting. The minimum height value will only be used when the FixedWidth is not set (restored to the default/auto setting). Setting the minimum height to zero or a negative value will restore the default/auto setting where no minimum height is enforced. (Read/Write number)
MinimumWidth
The minimum width of the item in pixels. When the width is dynamically determined, it will not be less than the minimum width setting. The minimum width value will only be used when the FixedWidth is not set (restored to the default/auto setting). Setting the minimum width to zero or a negative value will restore the default/auto setting where no minimum width is enforced. (Read/Write number)
Type
The object type string. (Read only string)
Visible
Controls the item visibility. Setting the visibility of an item to false will also hide items or their contents. (Read/Write boolean)

Method List

AddChild (item FormTreeItem)
Adds the given FormTreeItem as a child.
ClearCallBack ()
Clear the function that will be called when the tree selection changes.
SetCallBack (callback function)
Set the function that will be called when a tree item is selected.

Constructor Function List

New ()
Create a new tree. (Returns a FormTree object.)
New (label string)
Create a new tree. (Returns a FormTree object.)

Property Details

CurrentSelectedItem
The current selected tree item.
Type
FormTreeItem
Access
Read/Write
Enabled
Controls the item enabled state. Setting the enabled state of an item to false will also disable items or their contents.
Type
boolean
Access
Read/Write
FixedHeight
The fixed height of the item in pixels. When the fixed height is set to a positive value, it is the height of the item. Setting the fixed height to zero or a negative value will restore the default/auto setting and the height will be dynamically determined. The fixed height takes precedence over the minimum height and thus the minimum height is ignored when a fixed height is set.
Type
number
Access
Read/Write
FixedWidth
The fixed width of the item in pixels. When the fixed width is set to a positive value, it is the width of the item. Setting the fixed width to zero or a negative value will restore the default/auto setting and the width will be dynamically determined. The fixed width takes precedence over the minimum width and thus the minimum width is ignored when a fixed width is set.
Type
number
Access
Read/Write
ItemHeight
The height of the item in pixels.
Type
number
Access
Read only
ItemWidth
The width of the item in pixels.
Type
number
Access
Read only
MinimumHeight
The minimum height of the item in pixels. When the height is dynamically determined, it will not be less than the minimum height setting. The minimum height value will only be used when the FixedWidth is not set (restored to the default/auto setting). Setting the minimum height to zero or a negative value will restore the default/auto setting where no minimum height is enforced.
Type
number
Access
Read/Write
MinimumWidth
The minimum width of the item in pixels. When the width is dynamically determined, it will not be less than the minimum width setting. The minimum width value will only be used when the FixedWidth is not set (restored to the default/auto setting). Setting the minimum width to zero or a negative value will restore the default/auto setting where no minimum width is enforced.
Type
number
Access
Read/Write
Type
The object type string.
Type
string
Access
Read only
Visible
Controls the item visibility. Setting the visibility of an item to false will also hide items or their contents.
Type
boolean
Access
Read/Write

Method Details

AddChild (item FormTreeItem)
Adds the given FormTreeItem as a child.
Input Parameters
item(FormTreeItem)
The child item.
ClearCallBack ()
Clear the function that will be called when the tree selection changes.
SetCallBack (callback function)
Set the function that will be called when a tree item is selected.
Input Parameters
callback(function)
The function call back.

Static Function Details

New ()
Create a new tree.
Return
FormTree
The newly created tree.
New (label string)
Create a new tree.
Input Parameters
label(string)
The tree column header.
Return
FormTree
The newly created tree.