Using Tcl/Tk in primitives

Tcl (Tool Command Language) pronounced "tickle" was created in 1988 by John Ousterhout, while he was a professor at UC Berkeley. Since that time its use has spread through a wide variety of software industries for mission-critical integration tasks.

Tk is a graphical user interface toolkit that makes it possible to create powerful GUIs incredibly quickly. Both Tcl and Tk have been integrated into MLDesigner. Parts of the graphical user interface and all of the textual interpreter ptcl are designed using them. Several of the primitives in the standard primitive library also use Tcl/Tk. This chapter explains how to use the most basic of these primitives, TclScript, as well as how to design such primitives from scratch. It is possible to define very sophisticated, totally customized user interfaces using this mechanism.

In this chapter, it is assumed you are familiar with the Tcl language. Up-to-date documentation and software releases are available on the Tcl Developer Xchange web page at There is also a newsgroup called comp.lang.tcl.

The principal use of Tcl/Tk in MLDesigner is to customize the user interface.

Writing Tcl/Tk scripts for the TclScript primitive

Several of the domains in MLDesigner have a primitive called TclScript. This primitive provides the quickest and easiest path to a customized user interface.

Tcl utilities available to the programmer

A number of Tcl global variables and procedures that will be useful to the Tcl programmer have been incorporated into MLDesigner. Any of these can be used in any Tcl script associated with an instance of the TclScript primitive.

Creating primitives derived from TclScript

A large number of useful primitives can be derived from the TclScript primitive.