sml_tk(1)

NAME
sml_tk - Typed and abstract Standard ML interface to Tcl/Tk

DESCRIPTION
sml_tk is a Standard ML package providing a portable, typed and abstract interface to the user interface description and command language Tcl/Tk. It allows the implementation of graphical user interfaces in a structured and reusable way, supported by the powerful module system of Standard ML.

SML programs construct windows as sml_tk datatypes, which are then transformed into Tcl/Tk commands and sent over a pipe to a child wish process. Programs register event handlers with sml_tk, and then execute an event loop function which receives and dispatches events from the child process.

The FreeBSD port supports working versions of SML/NJ (110.65 or greater). Poly/ML 5.1 is supported, but there appears to be a problem with long communications to the child process as evidenced in the BigEx example, possibly because the SysDep structure is largely unimplemented. Likewise for MLton. Further investigation is required.

Moscow/ML and the blessed version of SML/NJ are not supported by the FreeBSD port, although they are in the standard distribution. These compilers use a deprecated version of the SML Basis Library: patches for the newer compilers cause errors.

  Using the library
The sml_tk library can be used in several different ways:

SML/NJ Executable
    The SML/NJ build installs an executable sml_tk, which gives an interactive loop with the sml_tk bindings. One could type, for example:
        BigEx.go ();

SML/NJ Library
    The library may be imported into an interactive session:
        CM.make "/usr/local/lib/sml_tk/sources.cm";

    or included in another .cm file. Possibly by adding a line to $HOME/.smlnj-pathconfig:
        sml_tk.cm /usr/local/lib/sml_tk
    and then including the library with
        $/sml_tk.cm.

Poly/ML Saved State
    The Poly/ML build saves the compiled bindings, they can be loaded with the command:
        PolyML.SaveState.loadState "/usr/local/lib/sml_tk/sml_tk.poly";

    One could then type, for example:
        CanvasEx.go ();

Poly/ML Compile
    To compile the bindings into Poly/ML, run:
        use "/usr/local/lib/sml_tk/root_poly.sml";

MLton Compile
    Include one or both of the basis files /usr/local/lib/sml_tk/sml_tk.mlb, /usr/local/lib/sml_tk/toolkit/toolkit.mlb.

    For example, to run the ScaleEx example, create a file scaleex.sml:

        val _ = ScaleEx.go ();

    and a file scaleex.mlb:

        $(SML_LIB)/basis/basis.mlb
        /usr/local/lib/sml_tk/sml_tk.mlb
        "%/usr/local/lib/sml_tk/tests+examples/scale_ex.sml"
        scaleex.sml

    Then build scalex by typing: mlton scaleex.mlb

ENVIRONMENT
Three sml_tk environment variables can be used to override the installed defaults:
SMLTK_TCL | Path to the wish executable
SMLTK_LIB | Path to the sml_tk library files (default: /usr/local/share/sml_tk)
SMLTK_LOGFILE | Set to log communications between the library and
wish.

EXAMPLES
The main library comes with several example structures, each contains a go function of type unit -> string:
ListBoxEx | GridEx | BigEx
CanvasEx | PopUpEx | ScaleEx
TagEx | WBindEx

The toolbox library also comes with several example structures, each with a go function:
WeeBoxes | FilerEx | MarkupEx
TableEx | TabsEx | LittleTreeList
SimpleInst | UW_Ex | StdMarkEx

COMPATIBILITY
The port adds two non-standard features:

Config.showColor
    Exposes a function mapping colors to their names.

WidgetTree.addLItemConf, WidgetTree.clearLItemConf
    Allow formatting of list items.

SEE ALSO
The website: http://www.informatik.uni-bremen.de/~cxl/sml_tk/

Local documentation: /usr/local/share/doc/sml_tk/manual.html

wish(1), and the rest of the Tcl/Tk documentation.

AUTHORS
Christoph Lüth and Burkhart Wolff wrote sml_tk and the first paragraph of this man page.

Timothy Bourke <timbob@bigpond.com> wrote the rest of the man page and some of the patches for the FreeBSD port.

BUGS
More work is required for Poly/ML and MLton. The Filer example crashes.