On Apr 3, 6:03 am, "Edward K. Ream" <[email protected]> wrote:

> > I'm trying to delete all the nodes in the current outline from a
> > script button.

The real problem is that iterators are not guaranteed to work while
the outline changes.

Instead of using iterators, this deletes all the top-level nodes
except the first (root) node::

root = c.rootPosition()
next = p = root.next()

while next:
    next = p.next()
    p.doDelete(next)
    p = next

c.selectPosition(root)
c.redraw_now()

You would have to do something similar to delete all the children of
the root node.

HTH

Edward


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to