Chapter 11 Commands

11.1 Introduction to CLIM Commands

In CLIM, users interact with applications through the use of commands. Commands are a way of representing an operation in an application.

Commands are performed by the command loop, which accepts input of presentation type command and then executes the accepted command. Section 11.3, "Command Objects," discusses how commands are represented.

CLIM also supports actions, which are performed directly by the user interface. Actions are seldom necessary, as it is usually the functionality of commands that is desired. See the macro define-presentation-action for a discussion of when presentation actions are appropriate.

CLIM supports four main styles of interaction:

A command is invoked by clicking on an item in a menu.

A command can be invoked by clicking on any object displayed by the interface. The particular combination of mouse-buttons and modifier keys (e.g.,SHIFT,CONTROL) is called a gesture. As part of the presentation system, a command translator turns a gesture on an object into a command.

The user types a complete textual representation of command names and arguments. The text is parsed by the command-line processor to form a command. A special character (usuallyNEWLINE) indicates to the command-line processor that the text is ready to be parsed.

A single keystroke invokes the associated command.

The choice of interaction styles is independent of the command loop or the set of commands. The relationship between a user's interactions and the commands to be executed is governed by command tables. A command table is an object that mediates between a command input context (e.g., the top level of an application frame), a set of commands, and these interaction styles.

For simple CLIM applications, define-application-frame will automatically create a command table and a top-level command input context, and define a command-defining macro for you.

Following a discussion of the simple approach, this chapter discusses command tables and the command processor in detail. This information is provided for the curious and for those who feel they require further control over their application's interactions. These are some circumstances that might suggest something beyond the simple approach:

If you do not require this level of detail, only read Section 11.2, "Defining Commands the Easy Way."


CLIM 2.0 User's Guide - OCT 1998

Generated with Harlequin WebMaker