47 lines
1.1 KiB
Elixir
47 lines
1.1 KiB
Elixir
|
|
||
|
--# Treeview built with Glade
|
||
|
|
||
|
include GtkEngine.e
|
||
|
|
||
|
add(builder,"~/demos/glade/list.glade")
|
||
|
|
||
|
-- retrieve some objects created by Glade that we'll need;
|
||
|
TreeView tv = pointer("treeview1")
|
||
|
ListStore store = pointer("liststore1")
|
||
|
TreeSelection selection = get(tv,"selection")
|
||
|
|
||
|
sequence veggies = {
|
||
|
"Broccoli",
|
||
|
"Cabbage",
|
||
|
"Beet greens",
|
||
|
"Swiss Chard",
|
||
|
"Collards",
|
||
|
"Asparagus ",
|
||
|
"Onions",
|
||
|
$}
|
||
|
|
||
|
set(store,"data",veggies) -- easy to load the list
|
||
|
|
||
|
main()
|
||
|
|
||
|
------------------------------------------------------------------------
|
||
|
global function on_treeview1_row_activated()
|
||
|
------------------------------------------------------------------------
|
||
|
integer row = get(selection,"selected row")
|
||
|
object mdl = get(tv,"model")
|
||
|
object selected = get(mdl,"col data",row,1)
|
||
|
Info(,,selected)
|
||
|
return 1
|
||
|
end function
|
||
|
|
||
|
------------------------------------------------------------------------
|
||
|
global function on_imagemenuitem10_activate()
|
||
|
------------------------------------------------------------------------
|
||
|
Info("window1",,"About this program")
|
||
|
return 1
|
||
|
end function
|
||
|
|
||
|
|
||
|
|
||
|
|