next up previous contents
Next: Bytecompiling Up: How it all works Previous: How it all works

Example

proc user_option {} {
  # Option / user
  Desc "This page will set the user option"
  ShortDesc "user options"

  CheckBox backup -text "Use backup" -help "..."

  Save {
    print "backup: $backup"
  }
}

In this example the Tcl procedure is called user_option, this name can be used to refer to this page from another page. NOTE: The procedure doesn't take any arguments.

The options which is descriped in this procedure will be available on a configuration page called user, which is located in the submenu Option, which will be accessable from the main menu page.

When the user enters this page, the text ``This page will set the user option'' will be shown at the buttom of the page.

A single checkbox will be located on the page, with the text ``Use backup''.

When the user select generate, this page will generate ``backup: 1'' if the check button is selected, otherwise the text ``backup: 0'' will be generated.

The procedures which makes up the modules are all called once, when the module is started. This makes it possible to use Tcl to calculate information at startup as seen in example the following example:

...
set fonts [exec getFontNames]
...
ListBox fontName -entries fonts

Here the fonts are read from the system with the unix command getFontNames, and the information is used in a ListBox widget.



Jesper Kjær Pedersen <blackie@imada.ou.dk>
Wed Oct 2 13:29:53 MET DST 1996