Classic Computer Magazine Archive COMPUTE! ISSUE 129 / MAY 1991 / PAGE 71

Toolbook proves objects make sense. (ToolBook for Windows) (objected-oriented programming) (column)
by Clifton Karnes


What's the hottest programming tool to hit the PC since the original Turbo Pascal? Without a doubt, it's Asymetrix's ToolBook for Windows (Asymetrix, 110 110th Avenue NE, Suite 717, Bellevue, Washington 98004; 206462-0501; $395).

Like Windows itself, ToolBook is an object-oriented, event-driven environment. This means that a program waits for events from the user and takes action based on the nature of these events. The user is in control, and the program is passive.

In ToolBook, this environment has two main elements: graphics objects and object handlers. Almost everything you see on the screen is an object, and a program communicates with these objects by sending messages to them whenever an event involving the object occurs. Objects, in turn, act on these events by executing handlers written in ToolBook's OpenScript programming language.

As an example, let's look at the familiar OK button. This button is an object, and when you click on it, this event causes the operating environment to send a message to the button telling it that it has been clicked. If you want to do something when this event occurs, you attach a message handler to the button. In the case of an OK button, the message handler might dismiss a dialog box.

That's the essence of ToolBook programming-objects and handlers, interacting by way of event-caused messages. ToolBook takes care of notifying you of events and sending messages. You have to create the objects for these events and attach handlers.

Creating objects using ToolBook's design tools is a pleasure. The program offers a high-quality set of object-based drawing tools, including Bezier curves, which rival those found in many dedicated drawing programs. Add to that support for millions of colors, most in dithered patterns, and you have an interface construction set that most programmers only dream about.

To help with interface design, ToolBook offers two basic groups of predefined objects: buttons and fields. (A third type of object, a hotword, is really a special type of button whose object is a word.)

Standard buttons come in a variety of types including push buttons, radio buttons, and check-box buttons. Styles are rectangular, rounded-corners, shadowed, and transparent.

Fields are used to display text or other objects and have as much flexibility as buttons. You can have scrolling, bordered, transparent, and record fields; record fields are just one example of ToolBook's special support for database construction.

If these objects aren't enough, you can create your own, and you can combine any number of objects into a group. And all objects can be moved, resized, and recolored at any time.

Behind the objects that make up a Toolbook program's interface are handlers written in OpenScript. As a programming language, it is complete, powerful, and very English-like. You can do almost anything in it that you can do in C or Pascal, but since OpenScript is interpreted, it can be slower.

As far as large-scale organization goes, ToolBook was inspired, at least in part, by the Macintosh-based HyperCard and its HyperTalk programming language. ToolBook uses a book metaphor in much the same way that HyperCard uses the stack.

Programs in ToolBook consist of one or more pages in a book. A page, like a book itself, is an object and can be used to represent almost anything-a record in a database, the main window of a word processor, a dialog box, or a page of text in a hyperlinked document.

ToolBook is so powerful and deep that it's hard to describe. I've been working with it for months, and I don't feel like I've really tapped its full potential. My only complaint with ToolBook is its speed. Although it does some things extremely fast-like putting graphics on the screen and sorting-no program can ever be too fast or too small. With careful design and coding, however, a ToolBook program can be made fairly speedy.

If you decide to take the ToolBook plunge, there are two additional packages you should know about. The first is Asymetrix's Author's Resource Kit, or ARK ($450). ARK is intended for developers, and although it comes with a very useful utility, BookLook, its big draw is its license to distribute the ToolBook runtime. If you plan to market your ToolBook applications, you'll need ARK.

The second package is R-Spy (Syndetic Management Systems, 15530 SE 184th Street, Renton, Washington 98058; 206-228-4026; $125). R-Spy is a programmer's utility that gives you instant access to any ToolBook script or object. With R-Spy, you can simply click the right mouse button on any ToolBook object (this hot click can be redefined), and you'll see a dialog box that lets you edit the script of the target, the book, the current page, or the page's background. You can also change the target and edit or view its properties. If you're serious about programming in Tool-Book, R-Spy is essential.