This is not a question, I just wanted to share a solution. When you have a
treeview with a lot of entries (a hundred base nodes with dozens of branches
each) and do a $Main->Tree->Clear (), this can clog up the CPU for a
considerable time. Here's what's much faster (up to 100 times, depending on
the size and depth of the tree):

        @tv = ($key = $Main->Tree->GetChild (0));
        push @tv, $key while $key = $Main->Tree->GetNextSibling ($key);
        $Main->Tree->DeleteItem ($_) while $_ = pop @tv;

Note using the keys in reverse order (pop @tv instead of shift @tv) does the
trick.


Reply via email to