Move TreeViewNode?

BlitzMax Forums/BlitzMax Programming/Move TreeViewNode?

Gabriel(Posted 2006) [#1]
I'm looking for a way to move a TreeViewNode and all it's child nodes from one part of a TreeView to another. I can do this by recursing the TreeView from the Node on down and Adding new nodes to the new parent node. Then delete the original. That's fine, but I'm just wondering if there's a quicker, easier way to do it. Just wondering whether I can use the inner workings of TreeView's to move the TreeViewNode from one parent to another without creating and destroying the nodes.

If I remove it from the Kids list of one and add it to the kids list of another, is that sufficient? Or do I need to do more?


Dreamora(Posted 2006) [#2]
Wouldn't it be enough to remove the node from parent .kids TList and just add it to the target treeview Kids tlist?

Because all kids etc are appended to it.

You will just need to update the gadget afterwards.

(ps: there is no no-oop way to do this)


Gabriel(Posted 2006) [#3]
Yep, you caught me pre-edit. I slipped and submitted before I'd added the last little question about removing from one kid list and adding it to the other. I'm just not sure if there is anything else which needs to be done, and which is going to come back to bite me later if I try to do it this way.


Dreamora(Posted 2006) [#4]
I don't know. The easiest way to find out is check out what the method does that actually adds the object to the kids list. if it does nothing else, then there is nothing else to do :)


Gabriel(Posted 2006) [#5]
I know, I just hate poking around in the MaxGUI source. I can never find anything. The other modules are fine, MaxGUI, I'm nowhere. As you say, there's no real alternative because just switching kids on it's own doesn't seem to work. There's no command to refresh a treeview as far as I can see, but opening and closing the nodes should do it and nothing has moved.


Dreamora(Posted 2006) [#6]
RedrawGadget does not help?

There is the method: _setparent
which you could execute after you removed the node from its current parent.


Gabriel(Posted 2006) [#7]
Nope, RedrawGadget didn't help, nor _setparent. Maybe I made a mistake in there somewhere, but I think I'll just go ahead and do it the long way, recursing, copying and removing.


skidracer(Posted 2006) [#8]
I spent a good day trying to fix the treeview redraw problem last week and unfortunately didn't make much progress. I think there is something obscure in windows I have overlooked so will study msdn further so we can get the things refreshing.


Kev(Posted 2006) [#9]
@skid, not sure if this would help, do you send the WM_SETREDRAW message to the treeview.

one note though i recall reading that microsoft confirmed this to be a bug!

SYMPTOMS!


If a program uses the WM_SETREDRAW message to turn off updating of a TreeView control before adding items, the TreeView control can behave strangely.

For example, if the item being added to the control uses the TVI_FIRST style to insert it to the top of the tree and the top of the tree is scrolled above the top of the visible window, it may be impossible to bring the item into view.

Another possible symptom is that the TreeView control doesn't repaint itself at all. These problems occur only if the program has used the WM_SETREDRAW message to turn off updating the TreeView control.



could this be the cause of the refreshing problem?