A quick tour of the outline-based script and menu editor in Frontier.
Outlines play a big role in Frontier. Scripts are outlines and so are menus. I've been using outliners for so long, they've become part of my basic vocabulary, it's easy to forget that for some people they are new and perhaps strange things.
So here are the basics of using the outliner that's built into Frontier.
What is an outliner?
It's a text editor that allows you to control the level of detail that's visible, and allows you to reorganize text according to its structure.
Outliners make great program editors because programs are hierarchic structures, and editing programs is easier if you have an editor that understands structure. The same is true of hierarchic menu bars.
Viewed from another angle, outlines are just lists of lists, carried on to as many levels as you want. The grouping is arbitrary and totally up to you. The outliner has commands that (hopefully) make it easy to browse and reorganize structured information.
As you look at an outline, scan down the left edge looking for black wedges. Any black wedge can be expanded, it has information collapsed underneath it.
To expand a line, double-click on the wedge.
Here's a screen shot:
And here's the same picture after the while loop body is expanded:
Notice that the wedge in front of this line turned to gray, indicating that it's already expanded.
You can move a line using the mouse or with command keys. When you move a line, all the lines underneath it move also, whether or not they're expanded.
To reorganize with the mouse, point at the wedge of the line you want to move. Note that the mouse cursor turns into a pointing finger. Point at another line. Note that its wedge turns into an arrow, indicating where the line will be dropped. If you nudge the mouse to the right, the arrow now points to the right. When you let up on the mouse, the line moves to its new location. If you don't like what it did, the Undo command works.
Little-known-fact: if you hold down the Option key as you let up the mouse, the destination line will not be expanded if you drop to the right of the destination headline. It's a much-requested feature that's already in the program.
Instead of using the mouse, I usually use the command keys to do my reorganizing. There are four of them, and they're easy to remember. Cmd-U moves a line up, cmd-D moves a line down, cmd-R moves a line to the right (turns it into the last subhead of the line above it) and cmd-L moves a line to the left (it becomes the next sibling of its former parent).
Some people like using Tab and Shift-Tab to move a line to the right and left.
Adding new lines to an outline
To add a new line to an outline, place the cursor above or near the point where you want to add the line, and press Return.
At this point, you may need to use cmd-U,D,R,L to reposition the line.
Type the text, if you want to enter another line, press Return. If you're done, press Enter.
Note that there are two modes in outliner: text mode, where the insertion point is the usual flashing caret; and structure mode, where the cursor is shown as a black inverse bar. You can toggle between modes by pressing the Enter key. You can also use the mouse -- if you're in text mode, click on the wedge to return to structure mode; if you're in structure mode, click on the text to get the flashing caret.
There are two ways to add a comment to a script outline, one is suitable for big comment blocks, and the other is useful when you want to tack a comment onto the end of a line.
If you want a line and all the lines nested underneath it to be viewed as a comment, press the Shift key while you press Return. Note that instead of a wedge, the line has a chevron to its left.
Any text that's indented under one of these lines is also viewed as a comment. You can go on and on, but thankfully, your readers can collapse the whole comment down to a single line. So if you're verbose, the code doesn't become totally unreadable.
For smaller comments that go at the end of a line, just enter a chevron character before the comment text. You enter the chevron character by pressing Option-.
Here's a screen shot of where I've expanded the comment, and added a short comment after the assignment to the variable named "count":
As you already know, Frontier has a built-in script debugger. What good would a debugger be if you couldn't set a breakpoint? Luckily, the debugger in Frontier is good, because you can set breakpoints. Here's how.
Hold down the Cmd key and click on the wedge next to the line. The wedge changes to a little hand. It toggles, so if you cmd-click on a breakpoint line, the hand turns back to a wedge.
As you debug the script, when the interpreter reaches a line with its breakpoint set, the interpreter stops, and allows you to examine or modify data that the script is operating on, or step thru the script, or set other breakpoints.
The outliner built into Frontier is (of course) fully scriptable. Check out the op verb docs for a complete list of verbs that can be used with outlines. By the way, "op" stands for "outline processor."
There are lots of neat outlining commands in Frontier's menu bar. They're all fairly transparent. Experiment. And don't forget about Undo!
© Copyright 1996-97 UserLand Software. This page was last built on 5/7/97; 1:41:54 PM.
It was originally posted on 5/6/96; 9:11:17 PM.
Internet service provided by Conxion.