# FormsEdit

FormsEdit is a stand-alone application that allows you to develop a FormsVBT user interface: the layout, the colors, the fonts, the text, the buttons, the pop-up windows, the shadows, ... everything except the application code that does whatever it is you're building a user interface to.

The shell-command `formsedit` takes an optional argument, the name of an `.fv` file you wish to edit. It also takes optional X11 parameters for specifying the initial display and geometry; the manpage has the details.

The following sections describe the user interface.

## Getting started

The initial text-editor window shown by `formsedit`.

When you start the program, you'll see two windows: an editor and a result view (see Figure [efig:start] ). The editor has a simple FormsVBT S-expression in it:

    (Rim (Pen 10)
      (Text (Name ignoreMe) "This space available for a small fee"))

The result view is simply a window that contains the text, surrounded by 10 points of whitespace, or in this case, ``greyspace'', since the default background color is light grey.

## The menubar

The menubar has four menus and a button.

### The quill-pen menu

This menu has four items:

About FormsEdit ... shows the copyright notice and other information.

Help pops up a window with an online help-file, containing a list of all the components and their properties.

Editing Model includes a choice of keybindings and selection controls; they also determine the keyboard equivalents that appear in the menu items. The four choices, Ivy, Emacs, Mac, and Xterm, are documented in the VBTkit Reference Manual [VBTkitRefman] .

Quit This terminates FormsEdit.

### The File menu

The File menu.

This menu (see Figure [fileMenu.e] ) contains a standard list of items:

New creates another pair of windows, using the same, simple S-expression.

Open..., which is selected in the figure, brings up a file browser.

Close closes the window. If you click Close or Quit while there are unsaved changes, you will be asked whether you want to save them.

Save and Save As... are self-explanatory.

Revert to Saved re-reads the expression from the disk file.

PP setup... brings up a window with a `Numeric` component that lets you establish the width that the pretty-printer should use; typing Return causes the S-expression to be pretty-printed at the new width. The user-interface descriptions in `.fv` files tend to grow fairly quickly. If you can afford the screen real-estate, you might try reshaping the editor window to be as wide as possible, setting the pretty-printer width to 150, and typing Return.

PPrint invokes the pretty-printer, and rewrites the S-expression in the window.

### The Edit menu

The Edit menu has buttons for Undo and Redo; buttons for the standard editing commands Cut, Copy, Paste, Clear, and Select All; a Find... button that brings up a dialog box for specifying the string you wish to search for; and buttons for Find Next and Find Prev, which look for the current Source selection.

### The Misc menu

The Misc menu contains an item for examining the named components in the form you're editing---it shows their names, types, and shapes; an item for producing a snapshot (see Section [sec:programming-snapshot] ); and a button to bring up the error-message window, which normally disappears 5 seconds after it displays a message. This menu also contains items that allow you to move the editor and result windows from one screen to another.

### The ``Do It'' button

The space to the right of the Misc button contains the name of the file being edited (if the window is showing a file). When there are unsaved changes to the window, a ``note'' icon also appears here.

After you've edited the file describing your user interface, you'll want to see what it looks like. Click the Do It button. On some keyboards, there's a (big) key labeled Do; you can press that instead of clicking the button. The key labeled Enter may also be used.

Every time you click the Do It button (or press the Do key or the Enter key), FormsVBT parses the entire S-expression, and updates the result view accordingly. The result-view window will change its shape, if necessary, to give the form its preferred shape.

## Errors

The error window. What if there's an error in your form? The parser will detect it and highlight the nearest enclosing S-expression. An error window will pop up, explaining what the error was. If you click the OK button in the error window, the highlighting will disappear.

For example, suppose you wanted to change the font in the sample S-expression, and instead of writing `Family`, you misspelled it as `Famly`. When you hit the Do It button, the error window pops up; see Figure~ [efig:error.e] . The `Text` subexpression is highlighted, and the error message says: {\tt Bad font-spec: (Famly "new century schoolbook")}.

When an error has been detected, the result view is not changed. If you open a window onto a file that contains an erroneous S-expression, its result window will be in some undefined state.

If we correct the misspelling and click Do It, the error window will disappear.