| Index | Parent | Listtree class |
This Listtree class is a Beta version.
The Listtree class is used to manipulate trees of lists.
A Listtree object can only be added to a Listview object at Listview creation time.
Despite Listtree class is declared to be subclass of List class, no List attribute and method may be used with a Listtree object.
Listtree is a subclass of Listtree.mcc so you must have Listtree.mcc in MUI:Libs/MUI to
use it.
Listtree.mcc is copyright of Klaus Melchior.
| ATTRIBUTES | |||
|---|---|---|---|
| Name | Type | Class | Note |
| ActiveID | N | ISGN | This attribute indicates the active entry in a Listtree. The
possible values are non negative integer, where 0 means no active entry, >0 means there
is an active entry. |
| ActiveName | S | ISG | The name of the active entry |
| DoubleClick | B | GN G2N | |
| DragDropSort | B | IS | |
| DropMark | N | G | |
| DropType | S | G | One of:
|
| EmptyNodes | B | IS | |
| Format | S | I | |
| Quiet | B | IS | |
| Title | S | I | |
| TreeColumn | N | ISGN | |
| METHODS | ||
|---|---|---|
| Name | Parameters | Note |
| Clear | Clear the whole Listtree. | |
| Close | Closes the whole Listtree | |
| FindName | <var>,<name>,[list],[flags] | Gets an entry by name. Arguments:
|
| GetEntry | <var>,[id] | Gets an entry by id. Arguments:
The method writes in var the entry and in the fields:
an ARexx boolean |
| GetEntry2 | <var>,[id],[pos],[flags] | Relative-gets an entry by id. Arguments:
The method writes in var the entry and in the fields:
an ARexx boolean |
| Insert | <entry>,[list],[prev],[flags],[name] | Arguments:
|
| Open | Opens the whole Listtree | |
| Remove | [id],[what] | Removes and entry. Arguments:
Note that if what is not supplied, all id is removed. |
| Sort | [id],[flags] | Sorts entries. Arguments:
|
Example
Static creation
list.Frame="InputList"
list.Format="BAR,"
list.Title="Name|Phone"
list.0="Friends"; list.0.flags="close"; list.0.list="am"
am.0="Frank|0864845111"; am.0.name="Frank"
am.2="University"; am.2.name="uni"; am.2.type="tree"; am.2.flags="close"; am.2.list="uni"
uni.0="Mary"; uni.0.name="Mary"
uni.1="Jhon"
uni.2="Profs"; uni.2.flags="list"
am.1="Robert"
list.1="Computer Shop"
Dynamic insertion
list.Frame="InputList"
list.Format="BAR,"
list.Title="Name|Phone"
...
call set("list","Quiet",1)
call DoMethod("list","Insert","Friends","root",,"List"); friends=rc
call DoMethod("list","Insert","Franck|0864845111",friends,,,"A")
call DoMethod("list","Insert","University",friends,,"List","uni"); uni=rc
call DoMethod("list","Insert","Mary",uni,,,"Mary")
call DoMethod("list","Insert","Jhon",uni)
call DoMethod("list","Insert","Profs",uni,,"list")
call DoMethod("list","Insert","Robert",friends)
call DoMethod("list","Insert","Computer Shop","root")
call set("list","Quiet",0)
How to get all the entries of a Listtree (with its structure)
call printList("root",0)
...
printList: procedure
parse arg l,s
call DoMethod("Listtree","GetEntry2","e",l,"head")
do while rc
say copies(" ",s) || "Name:"e.name "Value:"e "ID:"e.id "IsList:"e.list
if e.list then call printList(e.id,s+1)
call DoMethod("Listtree","GetEntry2","e",e.id,"next")
end
return