Siag - Form Input

# Form Input

The Form interface is a convenient way to create dialogs. It is done by adding different widgets to a form, using a collection of Scheme functions. Each input widget has a name and a value, and the results are returned as an associative list.

Example: form.scm

Example: data.scm

It is also possible to declare an area of the sheet to be a "database" and use the form interface to edit the contents. To do this, set the block on the first line of the fields in the area. These columns can now be edited using the (data-record-edit) function.

This is not a real database, only a nice way to edit the contents of a spreadsheet.

(form-begin)
  Start a new form
(form-label label)
  Add a label to the form
(form-text name)
  Add a text entry field to the form
(form-withprompt prompt value width)
  Create a label followed by a text field of a specified width
(form-record name name ...)
  Create a form with one label and one text field per line
(form-menu name)
  Add a pull-down menu
(form-menuentry text)
  Add one entry to the menu
(form-okbutton label)
  Add a button which pops down the form, collects the values and returns them
(form-cancelbutton label)
  Add a button which pops down the form, discards the values and returns the empty list
(form-property name value)
  Changes an X property of the most recently added widget
(form-properties name value name value ...)
  Changes several properties in a single call
(form-newline)
  Add the next widget below the last one, rather than to the right
(form-end)
  Pop up the form, wait for the user to do something, return the results
(data-fieldnames)
  Make a list of the strings from the first row of the block
(data-record-collect row)
  Collect the values from row row, returning the results as an associative list of the form
  ((fieldname . value) (fieldname . value) ...)
(data-record-store record row)
  Store a record back at row row
(data-record-form record labelwidth textwidth)
  Display a form with one line per field
(data-record-edit row)
  Edit one row in the "database". This is available on the menu as Data - Edit Record.