Is it a simple matter starting at the root item and working
my way through the tree and deleting all the branches?
You should really just call Fl_Tree::clear() to clear
the tree.
To remove a specific item (and its children, if any), Fl_Tree::remove(item).
You can try to do it yourself by deleting all the branch items,
but I'm pretty sure
you'd end up with the same results as just doing Fl_Tree::clear().
If there was
something wrong with the deallocating process, I'd think you'd
get the same results.
Fl_Tree_Item's are around 176 bytes per item on a 64 bit
machine, similar in size
to an Fl_Group. On top of that is the memory for the label()
string.
If you parented FLTK widgets to items using
Fl_Tree_Item::widget(),
to clear /those/, you can call: Fl_Tree::Fl_Group::clear().
So to clear the tree
and all child FLTK widgets I think you'd need to
use:
Comments are owned by the poster. All other content is copyright 1998-2025 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.