Next Prev Up Top Contents Index

11.2 Defining Commands the Easy Way

The easiest way to define commands is to use define-application-frame , which automatically creates a command table for your application. This behavior is controlled by the :command-table option. It also defines the command-defining macro you will use to define the commands for your application. This is controlled by the :command-definer option.

This command-definer macro behaves similarly to define-command , but automatically uses your application's command table, so you needn't specify one.

Here is a code fragment illustrating the use of define-application-frame , which defines an application named editor . A command table named editor-command-table is defined to mediate the user's interactions with the editor application. define-application-frame also defines a macro named define-editor-command , which you will use to define commands for the editor application and install them in the command table editor-command-table .

(clim:define-application-frame editor () ()
 (:command-table editor-command-table)
 (:command-definer define-editor-command) ...) 

Note that for this particular example, the :command-table and :command-definer options are not specified, since the names that they specify are the ones that would be generated by default. Provide these options only when you want different names than the default ones, you don't want a command definer, or you want to specify which command tables the application's command table inherits from. See the macro define-application-frame , in 9.2, Defining CLIM Application Frames for a description of these options.

11.2.1 Command Names and Command Line Names

11.2.2 The Command-Defining Macro

Common Lisp Interface Manager 2.0 User Guide - 14 Dec 2001

Next Prev Up Top Contents Index