Re: EuGTK:Replacing TreeView Data

new topic     » goto parent     » topic index » view thread      » older message » newer message

That's not such a big problem, I think, if you are just adding items within a subcategory. If you try to add a new main category, it would be difficult.

Here's how: in your ShowSelection() function (or whatever you call it), you have an iterator which points to the clicked item. There's no point in saving this, but you can save the path, which if you could see it in text form, would be something like 10:4:8 (11th category, 5th sub, 9th item) (zero based, naturally)

To get the path, just call

path = get(store,"path",iter)

If you want to see this in human-readable form, covert it using "to string":

display(get(path,"to string"))

Store the path(s) of the selected item(s) (not the human-readable version) in a sequence, so that you can reopen them by calling

for i = 1 to length(path) do 
  set(tv,"expand row",path[i],1) -- 1 expands fully, 0 expands only to the item - experiment.a 
end for 

It is possible to store the human-readable path strings in a sequence, and restore from that, if you wish.

I leave it up to you to figure out how to remove a path from your list if the user collapses one of the categories. (Connect to the "row-collapsed" signal)

None of the above is tested. Because the EuGTK function only does 4 levels of nesting. Remember, I don't do recursion. Somebody will need to rewrite that function to recursively create infinite levels of nesting, which is what your program is seeming to call for.

Hint: it's in GtkEngine, function ts_set_row_data()

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu