Chapter 6

Modal Tools

6.1 Assistance Applications and Modal Tools

This chapter is very lean... to be filled in at a later date...

List of direct manipulation tools:

Causes mouse and keyboard events to be sent to the object for processing. This is the default startup mode.
Let's you click-drag to move an object.
Let's you lick-drag to resize an object.
Selects an object by clicking on it. Can reference the currently selected by calling target().

The mode affect how the user's mouse actions are interpreted by viola.

When in "action" mode, user's mouse action get translated to events that are sent to the object. This is the default mode when the program start up.

When in "move" mode, clicking on an object does not produce the usual "buttonPress" and "buttonRelease" messages, but allows the user to drag and change the position of an object. When in "resize" mode, it lets one affect the width and height of an object's window.

When in the "target" mode, clicking on an object does not cause any messages to be sent to the object (as would in "action" mode"). Instead, the name of the object being clicked on is stored in a system variable and retrivable by the target() method.

However, object that are locked -- that is, the objects with the "lock" attribute being non-zero -- can not be selected themselves. This is so that the application builder can work normally (in action mode). But, don't worry about this unless you're thinking about writing an interface/application builder application (hint hint hint).

How to switch modes.


6.2 Command Shell

THe shell application is a way to issue commands to the viola interpreter. To invoke it in a script, execute this statement: send("shell", "render");. Or, click on any object (any viola window) while holding the control key.

This is what the shell looks like.

A statement that you enter into the shell is interpreted in the context of the target object (the object context is displayed in the "Object:" field). This means that the statement is executed as if that context object executed it.

For example, the statement ``get("name");'' yields different values depending on the context.

To change the context, you could use the select tool to pick another object, or use the target() method.

This shell hopefully will eventually develop into a full interface builder and object browser. Right now it's quite rudimentary, but it's useful for peeking and poking at objects for prototyping and diagnostic purposes.

GOTO Preface, Previous Chapter (5), Next Chapter (7)