Usage:
tree_box(Handle, Parent, Tree_func, _, X, Y, Width,
Height)
Creates a list box control.
Handle | handle. Use _ if you don't need it. |
Parent | handle of the parent window. Use _ for default. |
Tree_func | predicate which will receive edit messages |
X,Y | coordinates of upper left corner |
Width, Height | size of the window |
Look at tree box methods:
L is get_tree_length(Tree_Box)
S is get_tree_selected(Tree_Box)
R is tree_parent(Tree_Box, Item)
R is tree_child(Tree_Box, Item)
R is tree_next_brother(Tree_Box, Item)
insert_tree_item(Tree_Box, Item_Handle, Parent, After,
Text, Icon1, Icon2)
delete_tree_item(Tree_Box, Item)
get_tree_item(Tree_Box, Item, Text, Icon1, Icon2)
set_tree_item(Tree_Box, Item, Text, Icon1, Icon2)
clean_the_tree(Tree_Box)
set_tree_icons(Tree_Box, Icon1, Icon2, ...)
change_style
You can use this predicate to change the stile of your Tree_Box.
The information which you need for this is how bits in the style are connect
to list box features.
Here is the list of important bits:
1 | buttons (for opening of the item with children) | set |
2 | lines (connecting items) | set |
4 | root lines | set |
8 | in place edit |
in place edit
If you want to support in place edit then you should to set this style
(it is not set by default) and to proceed the message edit(Item, Text).
This message is send when some one tries to edit the label of some of the
tree items and contain the handle of the edited item and the new text.
The following example shows how this can be done:
?-
window( _, _, win_func(_),
"Tree Demo", 100, 50, 370, 420).
win_func(init) :-
tree_box(G_Tree_Box,
_, tree_func, _, 10, 10, 150, 350),
change_style(G_Tree_Box,
0, 0, 8),
insert_tree_item(G_Tree_Box,
_, root, first, "First", _, _).
tree_func(edit(Item,Text)):-
yes_no("Tree Demo","Are
you sure that you want to change this text.", ?),
set_tree_item(G_Tree_Box,
Item, Text, _, _).
See also:
tree box methods
window
Look at the example:
Tree Box.spj (in folder Examples)