NextPrevUpTopContentsIndex

8.2.1 Input Contexts in CLIM

Roughly speaking, the current input context indicates what type of input CLIM is asking the user for. You can establish an input context in CLIM with the following constructs:

accept

accept-from-string

present (with an accept inside)

The command loop of an application

with-input-context

The input context designates a presentation type. However, the way to accept one type of object may involve accepting other types of objects as part of the procedure. (Consider the request to accept a complex number, which is likely to involve accepting two real numbers.) Such input contexts are called nested . In the case of a nested input context, several different context presentation types can be available to match the to-presentation-types of presentation translators.

Each level of input context is established by a call to accept . The macro with-input-context also establishes a level of input context.

The most common cause of input context nesting is accepting compound objects. For example, you might define a command called Show File , which reads a sequence of pathnames. When reading the argument to the Show File command, the input context contains pathname nested inside of (sequence clim: pathname ) . Acceptable keyboard input is a sequence of pathnames separated by commas. A presentation translator that translates to a (sequence clim: pathname ) supplies the entire argument to the command, and the command processor moves on to the next argument. A presentation translator that translates to a pathname is also applicable. It supplies a single element of the sequence being built up, and the command processor awaits additional input for this argument, or the entry of a SPACE or RETURN to terminate the argument.

When the input context is nested, sensitivity considers only the innermost context type that has any applicable presentation translators for the currently pressed chord of modifier keys.


CommonLisp Interface Manager 2.0 User's Guide - 30 Jul 2004

NextPrevUpTopContentsIndex