Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1556
News FAQ
Search Home


next up previous contents index
Next: Frame Up: Glish/Tk Previous: Glish/Tk


Introduction

TCL/Tk was developed by John Ousterhout, and it has achieved wide popularity. TCL, Tool Command Language, was developed to be an embeddable language. It provides a simple easily extensible string based language that allows you to customize it for your particular application. Tk is a binding of graphical widget functionality to TCL. This allows widgets to be accessed directly from a simple interpreter.

The Tk widgets were chosen for Glish because they have been extensively used and are robust in an interpretive environment. It is very important that widgets which are used interactively handle bad input with grace. Tk is somewhat unique in this respect. Most widget toolkits are designed to be used as linkable libraries and are therefore intended for programmers rather than end users. As a result, these library toolkits have not tended to be very robust.

In creating Glish/Tk, every attempt was made to fully integrate the widgets into Glish, and as a result, it is not simply a binding of the Tk widgets to yet another language. In Glish/Tk, the widgets are synonymous with Glish clients. They are agents which you create with functions. Once created, these agents generate and respond to events. The events which they generate are almost always the result of user interaction with the widgets. The events generated by the Tk agents are handled just like any other events in Glish.

To use this client, you should be able to simply add -l glishtk.g to the command line invocation of Glish. This will start the client which serves up the widgets, and it will define all of the necessary functions.

While Glish/Tk is quite usable, it is not yet complete, and as a result, not all of the features found in TCL/Tk have made it into Glish/Tk. In addition, this chapter only gives an introduction to Tk. For more information about Tk, I would recommend ``Practical Programming in TCL and Tk'' 11.1.

For most of the Tk widgets, a table is provided listing the events the widget accepts or generates. Table 11.1 presents the meaning behind the arrows in these tables. These arrows provide a shorthand notation for indicating event flow between Glish and the widget.


Table 11.1: Event Legend
I/O Description
$ \rightarrow$ event sent from Glish and accepted by the widget
$ \leftarrow$ event generated by the widget
$ \Leftrightarrow$ request/ reply event
$ \leftrightarrow$ either $ \leftarrow$ or $ \rightarrow$ event

The default focus model for Glish/Tk is ``focus follows mouse''. The focus is always on the widget under the cursor. This is unlike the default TCL/Tk focus model, ``click to focus.'' Applications can change the focus model back to TCL/Tk's ``click to focus'' by setting:

    system.tk := [=]
    system.tk.focus := 'click'
before including glishtk.g.


next up previous contents index
Next: Frame Up: Glish/Tk Previous: Glish/Tk   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-10-15