Generic Function | Package: cg | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version

## virtual-key-up

Arguments: window buttons key-code

This generic function is called when the user releases a keyboard key. 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 works as in mouse-left-down, that is it 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:

- `left-mouse-button`
- `middle-mouse-button`
- `right-mouse-button`
- `first-x-button` (see `*ignore-mouse-x-buttons*`)
- `second-x-button` (see `*ignore-mouse-x-buttons*`),
- `shift-key`
- `control-key`
- `alt-key`

In addition, if the key that was pressed was one of several "extended keys" then the `extended-key` bit will be set. This is probably useful only when key-code is the value of `vk-control` or `vk-alt` and an application needs to know whether the righthand or lefthand version of this key was pressed. For these keys, the `extended-key` bit will be set for the righthand version only.

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.

key-code is an integer representing the key that was pressed. For a letter key, the key code is the char-int of the uppercase character shown on the key (and NOT the corresponding lowercase character). For a numeral key, it is the char-int of the numeral character. For any other key, the key code is the value of the `vk-` constant for that key (see `key-names` for a list of `vk-` constants); for keys that show both a shifted character and an unshifted character, this constant will be named after the unshifted character.

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.

|  | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version