Page 220 Table of Contents Index Page 222
Chapters
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30
A, B, C, D, E



CHAPTER 23. PRESENTATION TYPES


23.5 Context-dependent (Typed) Input

Associating semantics with output is only half of the user interface equation. The presentation
type system also supports the input side of the user interaction. When an application wishes to
solicit from the user input of a particular presentation type, it establishes an input context for
that type. CLIM will then automatically allow the user to satisfy the input request by pointing
at a visible presentation of the requested type (or a valid subtype) and pressing a pointer button.
Only the presentations that "match" the input context will be "sensitive" (that is, highlighted
when the pointer is moved over them) and accepted as input, thus the presentation-based input
mechanism supports context-dependent input.

Minor issue: What exactly is an input context? What does it mean for them to be nested?
| SWM

=> *input-context* [Variable]
The current input context. This will be a list, each element of which corresponds to a single
call to with-input-context. The first element of the list is the context established by the most
recent call to with-input-context, and the last element is the least recent call to with-input-
context
.

The exact format of the elements in the list is unspecified, but will typically be a list of a
presentation type and a tag that corresponds to the point in the control structure of CLIM
at which the input context was establish. *input-context* and the elements in it may have
dynamic extent.

=> with-input-context (type &key override) (&optional object-var type-var event-var options-
var) form
&body pointer-cases [Macro]
Establishes an input context of presentation type type; this must be done by binding *input-
context*
to reflect the new input context. When the boolean override is false (the default), this
invocation of with-input-context adds its context presentation type to the current context.
In this way an application can solicit more than one type of input at the same time. When
override is true, it overrides the current input context rather than nesting inside the current
input context.

type can be a presentation type abbreviation.

After establishing the new input context, form is evaluated. If no pointer gestures are made
by the user during the evaluation of form, the values of form are returned. Otherwise, one
of the pointer-cases is executed (based on the presentation type of the object that was clicked
on) and the value of that is returned. (See the descriptions of call-presentation-menu and
throw-highlighted-presentation.) pointer-cases is constructed like a typecase statement
clause list whose keys are presentation types; the first clause whose key satisfies the condition
(presentation-subtypep type key) is the one that is chosen.

During the execution of one of the pointer-cases, object-var is bound to the object that was
clicked on (the first returned value from the presentation translator that was invoked), type-var


Page 220 Table of Contents Index Page 222
Chapters
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30
A, B, C, D, E