Usage:
list_box(Handle, Parent, List_func, Lable, 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. |
List_func | predicate which will receive edit messages |
Lable | the label of the firs column |
X,Y | coordinates of upper left corner |
Width, Height | size of the window |
Look at list box methods:
R is get_list_text(List_Box, Position)
R is get_list_length(List_Box)
R is get_list_selected(List_Box)
insert_list_item(List_Box, Position, Text, Icon)
delete_list_item(List_Box, Position)
clean_the_list(List_Box)
set_list_icons(List_Box, Type, Icon1, Icon2, ...)
add_list_column(List_Box, Where, Label, Wide)
set_list_label(List_Box, Where, Position, Text)
change_style
You can use this predicate to change the stile of your List_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:
4 | single selection | set |
0x200 | in place edit | |
0x4000 | column header |
bits 1 and 2 are responsible for view style:
0 | Icon | |
1 | Report | set |
2 | Small | |
3 | List |
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
list 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(_),
"List Demo", 100, 50, 370, 420).
win_func(init) :-
list_box(G_List_Box,
_, list_func, "Name", 10, 10, 150, 350),
change_style(G_List_Box,
0, 0, 0x200),
insert_list_item(G_List_Box,
end, "First", _).
list_func(edit(Item,Text)):-
yes_no("List Demo","Are
you sure that you want to change this text.", ?),
set_list_label(G_List_Box,
Item, 0, Text).
See also:
list box methods
window
Look at the example:
List Box.spj (in folder Examples)