Next: , Up: Packages

3.1 Blox

Blox is a GUI building block tool kit. It is an abstraction on top of the a platform's native GUI toolkit that is common across all platforms. Writing to the Blox interface means your GUI based application will be portable to any platform where Blox is supported.

The Blox classes, which reside in the BLOX namespace and are fully documented in Graphical users interfaces with BLOX, act as wrappers around other toolkits, which constitute the required portability layer; currently the only one supported is Tcl/Tk but alternative versions of Blox, for example based on Gtk+ and GNOME, have been considered and might even replace Tcl/Tk in the future1. Instead of having to rewrite widgets and support for each platform, Blox simply asks the other toolkit to do so (currently, it hands valid Tcl code to a standard Tcl 8.0 environment); the abstraction from the operating system being used is then extracted out of gnu Smalltalk.

Together with the toolkit, there is a browsing system in the browser directory that will allow the programmer to view the source code for existing classes, to modify existing classes and methods, to get detailed information about the classes and methods, and to evaluate code within the browser. In addition, some simple debugging tools are provided. An Inspector window allows the programmer to graphically inspect and modify the representation of an object and a walkback inspector was designed which will display a backtrace when the program encounters an error.

The Transcript global object is redirected to print to the transcript window instead of printing to stdout, and the transcript window as well as the workspaces, unlike the console read-eval-print loop, support variables that live across multiple evaluations:

         a := 2   "Do-it"
         a + 2    "Print-it: 4 will be shown"

This browser evolved from an Xt-based version developed around 1993 written by Brad Diller ( Because of legal concerns about possible copyright infringement because his initial implementation used parts of ParcPlace's Model-View-Controller (MVC) message interface, he and Richard Stallman devised a new window update scheme which is more flexible and powerful than MVC's dependency mechanism, and allowed him to purge all the MVC elements from the implementation.

The code was then further improved to employ a better class design (for example, Brad used Dictionaries for classes still to be fleshed out), to be aesthetically more appealing (taking advantage of the new Blox text widget, the code browsers were enhanced with syntax highlighting), and to be more complete (adding multiple “views” to the inspector, namespace support and a complete debugger).

To start the browser you can simply type:


This will load any requested packages, then, if all goes well, a worksheet window with a menu named Smalltalk will appear in the top-left corner of the screen.


[1] The Gtk+ bindings for gnu Smalltalk are in an embryonic state; you can find them in the GTK package if you have Gtk+ 2.0 or later installed