| Index | Parent | NListtree class |
This NListtree class is a Beta version.
The NListtree class is used to manipulate trees of lists.
A NListtree object can only be added to a NListview object at NListview creation time.
Despite NListtree class is declared to be subclass of NList class, no NList attribute and method may be used with a NListtree object.
NListtree is a subclass of NListtree.mcc so you must have NListtree.mcc in MUI:libs/mui
to use it.
NListtree.mcc is copyright of Carsten Scholling.
| ATTRIBUTES | |||
|---|---|---|---|
| Name | Type | Class | Note |
| ActiveID | N | ISGN | This attribute indicates the active entry in a NListtree. The
possible values are non negative integer, where 0 means no active entry, >0 means there
is an active entry. |
| ActiveList | N | G | |
| ActiveName | S | ISGN | |
| AutoVisible | M | ISGN G2N | A number or one of:
|
| DoubleClick | M | ISGN G2N | A number or one of:
|
| DragDropSort | B | IS | |
| DragSortable | B | ISG | |
| DropTarget | S | GN | |
| DropType | S | GN | One of:
|
| EmptyNodes | B | IS | |
| Format | S | I | |
| MultiSelect | M | I | A number or one of:
|
| Quiet | B | IS | |
| ShowTree | B | ISGN | |
| Title | S | I | |
| TreeColumn | N | ISGN | |
| Visible | N | N | |
| METHODS | ||
|---|---|---|
| Name | Parameters | Note |
| Clear | Clear the whole NListtree. | |
| Close | [list],[what] | Closes an entry. Arguments
|
| FindName | <var>,<name>,[list],[flags] | Gets an entry by name. Arguments:
|
| GetEntry | <var>,[id],[flags] | 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 |
| GetSelected | <var> | Gets the list of the selected entries. Arguments:
The method writes in var.num the number of the selected entries and in var.0,... var.i (i=var.num-1) the entries: do i=0 to sel.num-1
say sel.i
end
|
| Insert | <entry>,[list],[prev],[flags],[name] | Arguments:
|
| Open | [list],[what] | Opens an entry. Arguments
|
| Remove | [id],[what] | Removes and entry. Arguments:
Note that if what is not supplied, all id is removed. |
| Select | [id],[selType] | Selects entries. Arguments:
|
| 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 NListtree (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