TOP | UP: Getting Acquainted | NEXT: The Database |
To work comfortably with Frontier, you need to be familiar with the various kinds of edit window in which you'll be doing most of your work. An edit window is a window in which you can perform editing actions, such as typing, cutting and pasting, and so forth. In this chapter, three main kinds of edit window are discussed.
First, we talk about outline edit windows. These allow you to construct and arrange text data in outline form; you can keep notes as outlines, and outlines can be used as input for automated processes (for example, an outline might tell Frontier what Web pages you want to generate). Also, two other kinds of Frontier edit window not discussed in this chapter - script edit windows and menubar edit windows - are basically just varieties of outline edit windows. (They are further described in Chapter 4, What a UserTalk Script Is Like , and Chapter 26, Menus and Suites , respectively.) In script edit windows, you write UserTalk programs that Frontier can execute, and in menubar windows, you customize Frontier's menus. So in order to work with these, you first need to know your way around an outline edit window.
Then, we discuss word-processing text (hereinafter referred to as wptext) edit windows. These are simple text document windows, often used as data for automated processes; for example, Web pages are often wptexts.
Finally, we talk about table edit windows. These are very important, because the database that accompanies Frontier (see Chapter 3, The Database ) consists of tables within tables within tables, and navigation within the database and operations upon it are performed primarily through table edit windows.
When you create an edit window, you must specify its type. An edit window of one type cannot be transformed into an edit window of another type. So, for example, if you create a new window as an outline edit window, you can create and edit an outline in that window; you cannot create a wptext in that window, and you cannot change the window to a wptext edit window.
The reason is as follows. When you create an edit window, you are really creating two things. One is the edit window; the other is the object, the thing to which the edit window gives access. Each type of object has its own appropriate variety of edit window, and object types that have edit windows cannot be transformed into one another. For instance, in the case of an outline edit window, there is also an outline object; you can't change an outline object into a wptext object, so you can't change its edit window into a wptext edit window.
Objects are primary; edit windows are secondary - they are just the means of accessing the object. It helps to think of the object as possessing an edit window, which it continues to possess whether or not that window is open. Assuming that you don't throw away an object, it persists; so you can dismiss its window, and then open it at a later time. Changes in an object's edit window are remembered with the object, so when an edit window is opened, it will appear in the same state as when it was last closed.
Objects are created in Frontier's database. The object may be created anywhere in the database, but until you are familiar with the database and the conventions about where to store objects in it, you should limit yourself to creating objects in the workspace table. To do so, choose Workspace from the Open menu, and then, from the Table menu that appears, choose New Outline, or New Text (for a wptext), or New Sub-Table (for a table). In the dialog that appears, assign the new object a name.1 The object will be created in the database, and its edit window will open.2
Figure 2-1 shows an outline edit window. When an outline edit window is frontmost, the Outline menu also appears at the top of the screen.
Outlines are hierarchical arrangements of lines of text. Each line's text may consist of at most 255 characters. If the edit window is too narrow to show the whole line, the line is not "soft-wrapped," but simply extends past the right edge of the window; to see more of such a line, widen the window, or scroll it horizontally.
You may change the font and size of the text in an outline edit window; this changes the font and size of all the text in the window. To do so, choose from the Font and Size submenus of the Edit menu; or, in the Main menu, choose any of the items in the Common Styles submenu.
Each line of an outline is preceded by a triangle. The triangle is a sort of "handle" for manipulating the line, as well as an indicator as to its status; the details are explained throughout these sections.
Distinguish between a line and its text. When you click on a triangle, it darkens and the text of the line is reversed; this means that the line itself is selected, and that the outline is in selection mode (illustrated in Figure 2-1, "this line is in selection mode"). In selection mode, you edit the outline by working with its lines - rearranging lines, making hidden lines visible, and so on.
If, on the other hand, you click within the text of a line, a blinking insertion bar appears; or you can click-drag to select some text, double-click to select a word, or triple-click to select all the text in a line. The outline is now in content mode . In content mode, you edit the text, which you do as you would in any word processor, by typing, cutting and pasting, navigating with arrow keys, and so on. (For arrow key modifiers, see "Wptexts," later in this chapter.)
To toggle between content mode and selection mode with the keyboard, hit the Enter key. Or, in selection mode, simply start typing: you will enter content mode automatically, and what you type will replace the contents of the selected line.
In selection mode, the physical line may be thought of as extending invisibly to both edges of the window. This means that when I say to click or drag a line's triangle, you can actually click or drag (in selection mode) any region to the left or right of the line. This is useful to know; many beginners think that the triangle is small, and hard to "grab" or "hit" with the mouse, whereas in fact there is no need to be so precise.
The indentation of a line's triangle indicates the hierarchical relationship between lines. A line whose triangle is as far to the left as possible is not hierarchically subordinate to any other line, and is called a summit-level line.
A line not at summit level is hierarchically subordinate to the line that is most immediately above it and to its left. Such a line is called a subhead of the line to which it is subordinate. So, for example, in Figure 2-1, both the line "subhead one" and the line "subhead two" are subordinate to "a summit-level line." From the other point of view, the line to which a line is subordinate is called its parent. So "a summit-level line" is the parent of "subhead three."
The sum total of lines subordinate to a given line - its subheads, and any subheads of those subheads, and so on - is referred to as the bundle subordinate to that line. Lines whose triangles line up one above the other are at the same level. Lines at the same level and part of the same bundle are called siblings . So, "subhead one," "subhead two," and "subhead three" are siblings.
Subheads may be expanded or collapsed, meaning that they are shown or hidden. This ability of subheads to be shown or hidden is what makes an outline a useful mechanism for viewing hierarchically organized text. No matter how much material the outline contains, its collapsible hierarchies help you see as much or as little of it as is convenient at any particular time.
In Figure 2-1, there are collapsed subheads subordinate to the line "this line has subheads you don't see." The line's triangle is differently shaded, to signify this.
Table 2-1 lists the methods of collapsing and expanding lines.
Navigation and reorganization in content mode work as in a wptext or any basic word processor - cut and paste, typing and deletion of text, and so forth. Our concern here is with selection mode.
In selection mode, the arrow keys move as described in Table 2-2.
Up or down among siblings 3 |
|
Up or down absolutely ("flatup" and "flatdown") among visible lines |
|
When a line is moved, copied, cut, or deleted, its subordinate bundle is automatically included, regardless of collapsed or expanded state. This is what makes an outline a useful mechanism for hierarchical storage and organization of textual data.
Multiple lines can be selected by Shift-clicking triangles or by adding the Shift key to arrow-key navigation. (To select all siblings of a given line, select the line and choose Select All from the Edit menu, or Shift-double-click its triangle.) The multiple selection may then be moved, copied, cut, or deleted. In what follows, it is presumed for simplicity's sake that the selection consists of a single line.
Copying, cutting, and pasting are performed with the usual commands in the Edit menu. Material pasted in selection mode is placed downwards from, and as a sibling of, the currently selected line. Pasting a line never causes the deletion of a line.
A line may be moved by dragging its triangle. An arrow appears, showing at each moment where the line would go if you were to release the mouse button. If you move a line so that it becomes subordinate to a line with collapsed subheads, the subheads expand and the line becomes the last of them. (You can change this behavior by holding the Option key: in that case, the line you are moving vanishes, as it becomes the last subhead and is collapsed all in one motion.)
To move the currently selected line with the keyboard, use Command-u, Command-d, Command-l, and Command-r to move the line up, down, left, or right respectively.4 Movement up and down is among siblings, and is thus restricted to the current bundle. Movement right means that the line becomes the last subhead of the sibling presently above it. Movement left means that the line becomes the next sibling of its current parent. Suppose, for example, in Figure 2-1, you select "subhead two" and hit Command-l. The line becomes summit-level, and occupies the first available "slot" after what was its parent, namely, just above "a second summit-level line."
Other reorganizational commands appear in the Outline menu. Promote causes all subheads of the currently selected line to become its siblings. Demote causes all siblings below the currently selected line to become its subheads. Sort sorts siblings.
To create a line, hit Return, either in selection mode or in content mode. The new line is created as a sibling down from the current line, unless the current line possesses expanded subheads, in which case the new line becomes the current line's first subhead.
To delete a selected line, hit Delete (or choose Clear from the Edit menu). This also deletes the line's subordinate bundle, of course, so be careful.
Figure 2-2 shows a wptext edit window. When a wptext edit window is frontmost, the WP menu also appears at the top of the screen.
The window works like that of any simple word processor. Text can have different fonts, sizes, and styles; use the Edit menu to apply them. Leading (the space between lines) and justification can also be set from the Edit menu. A ruler can be shown at the top of the window by choosing Ruler On/Off from the WP menu; with the ruler, paragraph justification, margins, and tabs can be set. The most common use of a wptext edit window, though, is simply as a way to work with long texts; the formatting is generally secondary.
Copying, cutting, and pasting all work in the usual way. When navigating with arrow keys, adding the Option key causes navigation by word; adding the Command key causes navigation to the start or end of the text. You can add the Shift key to arrow key navigation to select text.
Figure 2-3 shows two table edit windows. When a table edit window is frontmost, the Table menu also appears at the top of the screen.
A table is a collection of entries . An entry in a table has a name which is unique within the table; it also has a value, which is of some single type. In formal terms, then, a table entry is a name-value pair . We may say of a table that it contains its entries; from the opposite point of view, the table containing a given entry is called that entry's parent, or its parent table.
One possible type of table entry is a table; thus, one can have a table within a table (sometimes called a subtable ). This nested containment may be carried out to any desired depth, providing a containment hierarchy somewhat analogous to that of parents and subheads in an outline. Figure 2-3 illustrates this: the rear window contains three tables, one of which has been opened as the front window.
The job of a table edit window is to image the information about a table and its entries in a format that may be readily understood and conveniently manipulated. To this end, a table edit window has rows and columns. Each row corresponds to an entry; the columns correspond to the three pieces of information about each entry: its name, its value, and its value's type (referred to, in the window, as its "kind").
Referring again to Figure 2-3, consider the visible entries in workspace. Their values are of various types, as listed in the Kind column: an outline, a picture, a script, a number, a string, a binary, and a double. These are some of the many datatypes that an object's value can have in Frontier; they are discussed in detail in Chapter 10, Datatypes , and the details need not concern us for the present.
Now observe that, in some cases, the Value column actually shows us the entry's value; in other cases, though, it shows us only some information about the entry. For example, the entry count has a numeric value 37; the entry nine has a numeric value 9.0; the entry fee has a string value "fifofum" (and is of length 7, as the Kind column informs us). But the entry notepad is an outline, and an outline cannot be shown in a row of a table. To see the value of notepad, you would double-click its triangle; this causes notepad's edit window to open, showing the actual outline.
Not only is this a difference in how you see the values of entries; it is also a difference in how you edit the values of entries. An outline is edited in an outline edit window. A number, a string, or a double, on the other hand, is edited directly in its parent table; you simply alter what's in the Value column. A table entry like a string or a number, which is edited directly in its parent table, is called a scalar ; a table entry like an outline or a wptext, which is edited in its own edit window, is called a non-scalar. Scalar entries in a table edit window have a dotted triangle; non-scalar entries have a white triangle (which becomes black if the entry is selected).
Some types of entry can be transformed into other types of entry. For example, a string whose value is "31" can be transformed into the number 31. This is called coercion , and is studied in great detail in Chapter 10. You can perform any legal coercions on a table entry by selecting it and then choosing from the Kind popup at the bottom of the window; those datatypes into which the currently selected entry may be legally coerced are enabled, and choosing one performs the coercion.
Like an outline, a table edit window may be in selection mode or content mode.
In selection mode, an entry is selected as a whole. An entry selected as a whole can be cut or copied, or simply deleted by hitting Delete or choosing Clear from the Edit menu. Pasting takes place into the same table as the currently selected entry. If an entry is copied and then pasted right back into the same table, the pasted copy is renamed, to ensure uniqueness of naming; for example, myEntry would be pasted as myEntry copy. Pasting an entry will never cause automatic deletion of an existing entry (if Frontier thinks this might be what you want to do, it puts up a dialog and asks).5
In content mode, the information about an entry may be edited: you can change its name; if it is a scalar, you can change its value. Editing the name or (if it is a scalar) value of a table entry works as in any word processor. You can type, you can select text, you can copy, cut and paste; navigate with the arrow keys, and adding the Shift key selects. After editing an entry in content mode, it is important to return to selection mode; this causes the changes to "take."
As in an outline, you can toggle between selection mode and content mode by hitting the Enter key. Or you can click on an entry's triangle to select it in selection mode; click in its Name column text or (if it is a scalar) in its Value column to select it in content mode.
When you change a scalar value, Frontier has to guess what datatype you intend; if, after returning to selection mode, you find (by looking in the Kind column) that Frontier has guessed wrong, you can change the datatype with the Kind popup.
If you change a scalar value so that the new value is a valid UserTalk Expression, then when you return to selection mode Frontier evaluates the expression and replaces the value with the result. This is very convenient, and perfectly understandable once you know UserTalk (see Part II, UserTalk Basics ); but it can be surprising at first. For example, if you type 3+4 into a number's Value column, the value becomes 7. If this is not what you want, you may have to write a more explicit UserTalk expression; for example, to assign a string the value "3+4", you need to include the double quotes.6
There are two ways of creating a new table entry. One is to choose from the Table menu. Here, you must decide upon the entry's datatype beforehand. The various datatypes are arranged in the Table menu, in three groups: those visible as items within the Table menu itself, beginning with the word New; those dependent on the New Scalar submenu; and those dependent on the New Special submenu. Choosing any of these items presents a dialog in which to name the new table entry; the entry is then created in the same table as the currently selected entry.
A second method of creating a table entry is to select a table entry and hit Command-Return. This creates a new entry just below the currently selected entry; the new entry has no name and no datatype, so you need to assign them now. The entry is created in content mode, waiting for you to type a name. After typing the name, you can hit Enter to cause the name to "take." This will also cause the entry to be sorted into position, so it may jump as the name moves into its proper alphabetical place. Then you can edit the entry's value.
Table 2-3 summarizes keyboard shortcuts for table navigation.
In selection mode, select the first or last entry in the same table |
|
Select the entry and Command-Enter; select the entry and hit the Zoom button; or double-click the entry's triangle (hold Option key to dismiss the current window at the same time) |
|
Shift-Command-Enter; or double-click the window's titlebar 7 (hold Option key to dismiss the current window at the same time) |
|
Open an edit window's parent table, or its parent table, or its parent table (and so on) |
Command-click on the title in the titlebar, and choose from the popup menu that appears (hold Option key to dismiss the current window at the same time) |
With a little practice, the user will soon become adept at the various techniques for navigating and viewing database entries, so as to move comfortably and swiftly through the database without leaving too many windows cluttering up the screen.
Nevertheless, there is a certain tendency, in the heat of editing, for open windows to accumulate. A desired open window may be chosen from the Window menu, to bring to it to the front. A window may be closed by hitting Command-w; all open windows may be closed by hitting Option-Command-w when the Main Window is not frontmost. Windows are discussed in detail in Chapter 24, Windows .
The order in which a table's entries are displayed within its parent table edit window or beneath its parent row is called its sort order. There are three such orders, corresponding to the three columns. To sort entries, choose the desired order from the Sort popup at the bottom of the window, or simply click on the column name at the top of the window. The name of the column corresponding to the current sort order is underlined.
Columns may be widened and narrowed by dragging the column divider. The font and size of the text in the window may be changed; as with an outline, this affects all the text.
1. Frontier object names can be anything at all, provided the name is unique within its table; object naming conventions are discussed further in Chapter 6, Referring to Database Entries .
2. The workspace window is a table edit window; table edit windows are explained later in this chapter. The database itself is discussed in Chapter 3.
3. It is possible to change the behavior of the up-arrow and down-arrow keys so that they cause movement up or down absolutely, just like left-arrow and right-arrow. To do so, choose Quick Script from the Open menu, type op.flatCursorKeys(true), and hit Enter. In this mode, additionally, Command-left-arrow moves to the current line's parent and collapses the parent's subordinate bundle; Command-right-arrow expands the current line's subordinate bundle (if there is one) and moves to the first line of that bundle. To move to the first or last line, use Command-up-arrow and Command-down-arrow. The change in behavior will persist until Frontier is quit or until you say op.flatCursorKeys(false).
4. It is also possible to use the Tab key to move a line to the right, and Shift-Tab to move it to the left. You can disable this feature, perhaps in order to type a tab character in the text of an outline, which is not normally possible. To do so, choose Quick Script from the Open menu, type op.tabKeyReorg(false), and hit Enter. The change in behavior will persist until Frontier is quit, or until you type op.tabKeyReorg(true).
5. It is impossible to create a table entry with the same name as an existing entry, so in general Frontier responds helpfully when you try to do so. An interesting situation arises if you copy text, then enter selection mode in a table edit window and paste. This ought to mean that you are trying to create a new table entry, but you do not have a full table entry on the clipboard. Frontier responds by creating a new wptext entry containing what was on the clipboard.
6. It is not possible to give a table entry a "live" value; the value is evaluated and assigned when you return to selection mode. For example, if you give a table entry the value clock.now(), its value will become the date and time when you made this assignment - it will not become a live, "ticking" clock.
TOP | UP: Getting Acquainted | NEXT: The Database |