char-to-key-name

Function

Package: common-graphics

Arguments: char &key return-comtab-event

This function takes a lisp character object as an argument and returns the name of the key that is pressed in order to type that character. This name may be a lisp character object such as #\A or one of the vk-... constants such as vk-period. A second returned value is an integer which is a logior'ed value indicating which shift keys are used with the returned key in order to type the character; the logior'ed values are the values of the symbols shift-key, control-key, and alt-key (whichever of those keys are down).

Examples:

> (char-to-key-name #\*)
#\8
4         (4 is the value of shift-key)
> (char-to-key-name #\>)
vk-period
4

If the keyword argument return-comtab-event is true, then instead of the two returned values detailed above a single value is returned. This value is an event-synonym specifier list in the format that is passed to set-event-function or the :event-synonym initarg of a menu-item.

Examples:

> (char-to-key-name #\* :return-comtab-event t)
(shift-key #\8)
> (char-to-key-name #\> :return-comtab-event t)
(shift-key vk-period)

This function may be needed if for applications that must work on keyboards that do not place all shifted special characters with the same unshifted characters with which they are placed on a standard U.S. PC keyboard.

Common Graphics and IDE documentation is described in About Common Graphics and IDE documentation in cgide.htm.

The documentation is described in introduction.htm and the index is in index.htm.

Copyright (c) 1998-2000, Franz Inc. Berkeley, CA., USA. All rights reserved.

Created 2000.10.5.