SpecTcl quick tips

# Quick Tips

Widgets | Layout | Using the user interface | Navigation | main help

## Widgets

- To create a widget, drag it from the palette onto the grid, or select a palette widget, and click on the grid. If you click or drag off the grid new cells will be added as necessary. Frames can only be clicked onto the grid once.
- To select a widget, click on it (or use the shift arrow keys).
- To configure a widget, select it, then:

- Use the tool-bar
- Use the option sheet - Double-click on the widget (or key `control-w`).
- Repeat the last change - key `control-r`

- To move a widget, drag it to another location.
- To copy a widget, Shift-drag it to another location.
- To Delete a widget, select it, then hit the `delete` key, or press the delete button.
- To change a widget's size, make the widget stick to the sides of its cell, and then change the size of the cell by Dragging its `row` or `column` handle (at the left or top of the canvas) or the `row` or `column` gridline
- To change the span of a widget - select it, and drag its resize handles.

## Layout

- To add a new row or column - click on a grid line to select it, and press the insert key, or the insert button. To add both, click in a grid square to select both the row and column, and press the insert key.
- To select a row or column

- Click on the row or column handle (it will turn the selection color as set in the Preferences, on the Appear tab).
- Click on an empty cell.

- To delete a row or column - select it and press the `delete` key or press the delete button.
- To change row or column resizeability - select it and click on it. The arrow shape reflects its resizability.
- To make a sub-grid, create a `frame` widget.

- Use sub-grids when widgets don't align on rows and columns

## Using the user interface

- To test the interface, key `control-t`.
- To stop the test, key `control-k`.
- For a project named foo

- The project is saved in the file foo.ui
- The tcl code is saved in the file foo.ui.tcl
- The procedure is called foo_ui, and is called with the name of the frame or toplevel it should be instantiated in.
- If the application code is in a file called foo.tcl, The application code will be run as part of testing the interface, and must call `foo_ui`. MAC NOTE: interfaces built on the Macintosh will have a type and creator of 'STui/Spec'. The resulting tcl file will have a type and creator of 'TEXT/WIsH'.

- All widgets in an interface are siblings in the widget hierarchy, and named with the item_name option.
- For the widget options in the command property, The following substitutions are made:

%B
  The base portion of the widget name (e.g. the part of the name preceding the final ".").
%R
  The parent of all of the widgets
%M
  The geometry master for this widget
%W
  The complete pathname of the widget

- Additional Tcl code can be inserted into the user interface procedure after all of the widgets have been created using the edit code option of the edit menu.

## Navigation

- To select a widget, click on it.
- To select a row or column, click on its handle, or click in the empty cell.
- To select a row or column gridline click on it.
- To select the nextwidget, key `Shift-right-arrow`.
- To select the previous widget, key `Shift-left-arrow`.
- To enter a sub-frame, key `down-arrow`.
- To enter a parent frame, key `up-arrow`.