All Manuals > LispWorks® User Guide and Reference Manual > 47 The SYSTEM Package

coerce-to-gesture-spec Function

Summary

Returns a gesture-spec.

Package

system

Signature

coerce-to-gesture-spec object &optional errorp => gspec

Arguments
object
A character, keyword, gesture-spec or string.
errorp
A generalized boolean.
Values
gspec
Description

The function coerce-to-gesture-spec returns a gesture-spec gspec which can be used to represent the keystroke indicated by object.

If object is a Lisp character, then gspec's data is its cl:char-code and gspec's modifiers are 0.

If object is a keyword, then it must be one of the known Gesture Spec keywords and becomes gspec's data. gspec's modifiers is 0.

If object is a string, then coerce-to-gesture-spec expects it to be a sequence of modifier key names separated by the - character, followed by a single character or a character name as returned by name-char or the name of one of the known Gesture Spec keywords. Then gspec contains the corresponding Gesture Spec keyword or char-code in its data, and the modifier keys are represented in its modifiers.

If object is a gesture-spec, it is simply returned.

coerce-to-gesture-spec does not create wild gesture specs.

If object cannot be converted to a gesture-spec and errorp is non-nil (the default) then an error is signaled. Otherwise nil is returned.

Examples
(sys:coerce-to-gesture-spec :F10)
=>
#S(SYSTEM:GESTURE-SPEC :DATA :F10 :MODIFIERS 0)
 
(sys:coerce-to-gesture-spec "Ctrl-C")
=>
#S(SYSTEM:GESTURE-SPEC :DATA 67 :MODIFIERS 2)
 
(sys:coerce-to-gesture-spec "Shift-F10")
=>
#S(SYSTEM:GESTURE-SPEC :DATA :F10 :MODIFIERS 1)
See also

gesture-spec
gesture-spec-control-bit
gesture-spec-p
gesture-spec-to-character
make-gesture-spec
print-pretty-gesture-spec


LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:31:02