TKKIT --- a GUI class library for the Tk toolkit

Matthias Ernst
mernst@x4u2.desy.de

Introduction

The TkKit is an older version of the Gui classes and is used by the Browser, since the browser was written before the full Gui was developed. It is an interface to Tcl-Tk. The browser only makes use of the most rudimentary classes, but the whole interface is preserved here, in case other users may want to use it. This document is a modified version of Matthias original documentation. TkKit will not be directly supported by ICSI, but this document is provided for any who wish to make modifications to the Browser interface to the Gui. You will find it in Browser/TkKit.

The Class Library

TKKIT -objects represent graphical, possibly interactive objects which form the user interface of an application. There are two forms of TKKIT -classes:

The TK_APP class

  This class represents the GUI part of an application. Due to technical reasons this is just a wrapper around shareds. Features:

Windows

  Now we come to the really graphical objects. Here an overview over the existing window classes:
$TK_WINDOW
    $TK_TOPLEVEL
        TK_ROOT
        TK_TOPLEVEL
    $TK_WIDGET
        TK_FRAME
        TK_LABEL
        TK_ENTRY
        TK_MESSAGE
... really to be continued.

You can bind callbacks to events with 'bind' where the event specification is a string that Tk understands.

The $TK_WINDOW class

  Basetype for all windows in Tk, i.e. such with a pathname. Features:

The $TK_WIDGET class

  Objects of this type represent Tk widgets inside of top level windows. TK_WIDGETs add facilities of placement and geometry management using Tk's packer. By now you can assign to widget.pack_info: STR which is handed verbatim as options to TK's 'pack'.

An example

  The benefits of TKKIT can best be seen in an example. Edit one entry and hit return to get the corresponding temperature

class TEMPERATURE is
   attr celsius, fahrenheit: TK_ENTRY;

   c2f is
      c ::= #FLT(celsius.get);
      fahrenheit.set((c*1.8 + 32.0).str);
   end;

   f2c is
      f ::= #FLT(fahrenheit.get);
      celsius.set(((f-32.0)/1.8).str);
   end;

   main is
      app ::= #TK_APP("temperature", "Temperature", "/usr/local/Sather/System/Library/TkKit/Library/");

      caption ::= #TK_LABEL("caption", app.root).relief_raised;
      caption.text := "Temperature converter";

      f ::= #TK_FRAME("f", app.root).relief_raised;

      f1 ::= #TK_FRAME("f1", f).configure("bd", 2).relief_ridge;

      cl ::= #TK_BUTTON("cl", f1);
      cl.text := "Celsius degree: ";
      cl.pack_info := "-side left";

      celsius := #TK_ENTRY("ce", f1).relief_sunken;
      celsius.pack_info := "-side left";

      f2 ::= #TK_FRAME("f2", f).configure("bd", 2).relief_ridge;

      fl ::= #TK_BUTTON("fl", f2);
      fl.text := "Fahrenheit degree: ";
      fl.pack_info := "-side left";

      fahrenheit := #TK_ENTRY("fe", f2).relief_sunken;
      fahrenheit.pack_info := "-side left";

      f2c_cb ::= #TKKIT_CB("f2c", #ROUT(f2c));
      c2f_cb ::= #TKKIT_CB("c2f", #ROUT(c2f));

      cl.callback := c2f_cb;
      celsius.bind("", c2f_cb, void); -- no args

      fl.callback := f2c_cb;
      fahrenheit.bind("", f2c_cb, void);

      app.root.show_all;
      app.tcl_tk.main_loop;
   end;
end; -- class TEMPERATURE

-------------------------------------------------------------------

About this document ...

TKKIT --- a GUI class library for the Tk toolkit

This document was generated using the LaTeX2HTML translator Version 95.1 (Fri Jan 20 1995) Copyright © 1993, 1994, Nikos Drakos, Computer Based Learning Unit, University of Leeds.

The command line arguments were:
latex2html -split 0 -no_navigation TkKit.latex-2e.tex.

The translation was initiated by Benedict A. Gomes on Fri May 24 21:58:17 PDT 1996

...
Pronounce it like `ticket'



Benedict A. Gomes
Fri May 24 21:58:17 PDT 1996