|
|
On 6/11/21 6:00 AM, 'pvr...@btinternet.com'
via fltk.general wrote:
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:
tree->clear();
tree->Fl_Group::clear();
--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/6f87c74a-b264-8a9c-c7ae-e084029b7538%40seriss.com.
[ Direct Link to Message ] | |
|
| |