Re: Tree using wxEuphoria
- Posted by gbonvehi Mar 24, 2012
- 2055 views
The void is a global variable used to store results which are not needed, that's why it doesn't use it later.
Basically when you build a tree, you need a reference to each node on the tree to work on it later.
If you see in the code, the first added node is stored as root.
Then each subitem of root, is saved inside items so they can later be referenced to add more subnodes to them.
Some pseudocode:
root = add_tree_root() -- This will act as the holder of all my items subitem1 = add_tree_item(root) -- Add an item to root, and save this id as subitem1 subitem2 = add_tree_item(root) -- Add an item to root, and save this id as subitem2 subitem1_1 = add_tree_item(subitem1) -- Add an item to subitem1
This is done on the example using the sequence called items instead of individual variables.
Cheers,
Guillermo
PS: I downloaded wxEuphoria and added a handler to test and works great, I got the info from here: http://wxeuphoria.sourceforge.net/sfdocs/EVENT.html
It will popup after selecting an item from the treeview
procedure on_sel_changed(atom this, atom event_type, atom id, atom event ) atom item = get_tree_event_item( event ) message_box( get_tree_text( tree, item ), "on_sel_changed", wxOK ) end procedure set_event_handler( tree, -1, wxEVT_COMMAND_TREE_SEL_CHANGED, routine_id("on_sel_changed") )