NextPrevUpTopContentsIndex

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. 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:

Mouse interaction via command menus

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

Mouse interaction via command translators

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.

Keyboard interaction using a command-line processor

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 (usually NEWLINE ) indicates to the command-line processor that the text is ready to be parsed.

Keyboard interaction using keystroke accelerators

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:

Your application requires more than one command table if, for example, it has multiple modes with different sets of commands available in each mode.

If you have sets of commands that are common among several modes or even among several applications, you could use several command tables and inheritance to help organize your command sets.

Your application may be complex enough that you may want to develop more powerful tools for examining and manipulating command tables.

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


CommonLisp Interface Manager 2.0 User's Guide - 18 Mar 2005

NextPrevUpTopContentsIndex