Generic FunctionPackage: cgToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.1
Unrevised from 10.0 to 10.1.
10.0 version


Arguments: window buttons character

This generic function is called when the user types a graphical character, unless a virtual-key-down method overrides the default behavior. An application may add methods to this generic function to respond to keyboard events in its windows.

window is the window that had the keyboard focus when the event occurred. The keyboard focus is usually indicated by some sort of highlighting.

buttons is an integer indicating which mouse buttons and shift keys were down when the event occurred. The value is the result of applying logior to the values of the following bit-flag variables:

Other bits might be turned on as well, so functions such as logtest should be used to determine whether a particular mouse button or shift key was down; for example,

(logtest right-mouse-button buttons) 

will return true if and only if the right mouse button was down. For "down" events, the value includes the button or key being pressed now; for "up" events, the value does not include the button or key being released.

character is the character that was typed. It is always a Common Lisp character object.

While a keypress will always cause virtual-key-down and virtual-key-up to be called, it will cause character-message to be called only under certain conditions. First, the keypress must indicate a graphical character. second, one of the following must be true:

  1. The window in which the key was pressed is a dialog-mixin instance or a child or other descendant of a dialog-mixin instance.
  2. The default virtual-key-down method must run (since this method tells the operating system to generate a character message from the virtual-key-down message).

Therefore, if an application adds a virtual-key-down method for a window that is not on a dialog, and this method does not call (call-next-method) for a particular keypress, then the default virtual-key-down method is not called, and therefore character-message will not be called for that keypress.

See cg-events.htm for information about event handling in Common Graphics.

Copyright (c) 1998-2022, Franz Inc. Lafayette, CA., USA. All rights reserved.
This page was not revised from the 10.0 page.
Created 2019.8.20.

Allegro CL version 10.1
Unrevised from 10.0 to 10.1.
10.0 version