FunctionPackage: cgToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.2
Unrevised from 8.1 to 8.2. Moderate update since 8.2 release.
8.1 version

mouse-button-state

Arguments: nil

Returns an integer whose bits reflect the state of the mouse buttons and keyboard shift keys at the time that the event currently being handled occurred. A one bit indicates that the button or key was down, and a zero bit that it was not. For example, the expression

(logtest left-mouse-button (mouse-button-state))

will return true if and only if the left-mouse-button was down when the event currently being handled occurred. To determine whether a mouse button is down now, use key-is-down-p instead, passing one of the "key" constants vk-lbutton, vk-mbutton, or vk-rbutton (though that works on Windows only).

This function operates per-thread. Specifically, a mouse click that is done on a window that was created in a particular thread will not be included in the value returned by a call to mouse-button-state in any other thread. (An exception is that if there is a single window hierarchy that contains windows from both threads, then the operating system appears to combine the event queues of the two threads, and mouse-button-state will still include mouse clicks and shift key presses that were done in a window of the other thread.)

The following list shows the correspondence of buttons and keys to constants defined in Allegro CL for Windows.

Note: while an event is being handled, the returned value reflects the state at the time that that event occurred. For example, if you call mouse-button-state in an event method for a button-down event, then the returned value will indicate the mouse buttons and shift keys that were pressed when this event occurred, even if the user has released the buttons and keys at the time that the call to mouse-button-state is made.

See also down-keys, down-key-names, key-is-down-p, and key-was-down-p.


Copyright (c) 1998-2012, Franz Inc. Oakland, CA., USA. All rights reserved.
Documentation for Allegro CL version 8.2. This page was not revised from the 8.1 page.
Created 2010.1.21.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.2
Unrevised from 8.1 to 8.2. Moderate update since 8.2 release.
8.1 version