GenericTree
GenericTree copied to clipboard
Add OwnsObject, Root properties
Enhancements: OwnsObject should work as in other generic collection types. Destroy descendants of TObject. Root returns the topmost parent of a node.
Maybe also add an event OnNodeDestroy.
I second these, it would be useful. In my limited use I keep a fixed variable for the root, but I could see where passing a node as a parameter to some general purpose function might take advantage of being able to get to the root without having to recursively back walk the parent nodes.
For the TObject support, maybe having a descendant TObjectNode<T:TObject>
that has the OwnsObject
and OnNodeDestroy
methods would also enforce typing through the constraint?