GenericTree icon indicating copy to clipboard operation
GenericTree copied to clipboard

Add OwnsObject, Root properties

Open pyscripter opened this issue 6 years ago • 1 comments

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.

pyscripter avatar Nov 05 '18 22:11 pyscripter

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?

skamradt avatar Mar 21 '24 15:03 skamradt