Stuck up a tree!

I’ve got an Array<thingie*, criticalsection> of thingies which I’m representing in a treeview (the thingies are also sortof arrays)

The treeviewitem holding this uses Array.size to decide how many subItems it has. now I’d like the subitems to be able to remove themselves (eg via a popupmenu)

so when a remove request is recieved, the array element is removed then treeHasChanged() is called.

but the tree still trys to draw the (gone) item.

is my popupmenu causing a repaint to kick in while the Array is updating itself do you think? shouldn’t the criticalsection help here?

You’d need to actually remove the item from its parent item with the TreeViewItem::removeSubItem() method - calling treeHasChanged just makes it repaint and refresh the components, it doesn’t make it rebuild the actual tree structure itself.

dang, beat me to it :smiley:

M’kay…

so the tree only rebuilds the structure when a removeSubItem or addSubItem happens?

hmmm…

might change me tictacs…

Well you can change the structure any time you like with the add/remove commands, but that’s the only way to do it - it’s not like the old style tree where you sent an update request and then it asked you what the nodes should be. It’s more ‘push’ than ‘pull’ now.