op.visit

Syntax op.visit (callback)

Params callback is the address of a script to be applied to each heading traversed by op.visit.

Action Visits each subhead subordinate to the current heading, applying the script at callback to each subhead. If the script being applied to each subhead returns false, op.visit returns false and halts processing.

Returns True or false depending on the value returned by callback.

Examples In examples.Sample Outline 1, position the cursor on "Summit 2" and then execute:
op.visit (@script.makeComment)


   » true

You can probably watch Frontier go through the headings subordinate to Summit 2 and convert them all to comments. Now you can reverse the process by placing the cursor on "Summit 2" again and executing:
op.visit (@script.unComment)


   » true

Notes It is often a good idea to use op.getDisplay and op.setDisplay to freeze the screen while traversing an outline with op.visit since the display can be quite distracting.

The callback routine takes no parameters, and if it returns false the traversal halts.

Discuss