How can I move an HTREEITEM to a new parent?

Raymond Chen

Suppose you have a TreeView control, and you created an item in it, and you want to move the HTREEITEM to a new parent. How do you do that?

You can’t, at least not all in one motion.

You will have to delete the HTREEITEM and then re-create it in its new location.

If you want to move an HTREEITEM within the same parent (say, to reorder it among its siblings), then you can use Tree­View_Sort­Children­CB and pass a custom sort function that rearranges the children into the order you want.


Discussion is closed.

Feedback usabilla icon