Matthias Ernst
mernst@x4u2.desy.de
TKKIT -objects represent graphical, possibly interactive objects which form the user interface of an application. There are two forms of TKKIT -classes:
create(basename, classname, your_tkkit_path: STR): SAME
: This is a
fake ! Call this at the beginning of your application
(i.e. app ::= #TK_APP("tk_clock", "TkClock", "/home/tisi/sources/sather/TkKit/");
) to initialize
the shareds. You can safely handle the result like an object.
tcl_tk: TCL_TK
: The interface to the Tcl/Tk lib,
including the interpreter.
windows: FMAP{STR, $TKWINDOW}
: All windows in this
application (plus related routines).
callbacks: FMAP{STR, $TKKIT_CB}
: Defined callbacks (plus
related routines).
$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.
app: TK_APP
: The application this window belongs to.
typus: STR
: The type of this window, i.e. ``label'',
``frame'' or others. This is the command handed to Tk to create a widget.
name: STR
: The `basename' of the window's
pathname: STR
: Tk pathname
show; show_all; hide; hide_all; visible: BOOL
: control
visibility
configure(STR)
: ``low level'' Tk window configuration
destroy
: Destroy this window
widget.pack_info: STR
which is handed verbatim as options to TK's 'pack'.
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 -------------------------------------------------------------------
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