Keyboard Table of Contents | Keyboard Index |
Conceptually, there are eight modifier keys. The global modifiers() function returns a value that encodes the current status of all eight of these keys. You can test for the state of a particular modifier key by comparing modifiers() with the constants listed in the table below. For example, here's how you can see if the user is holding down one of the Shift keys:
if (modifiers() | B_SHIFT_KEY) { /* a shift key is down */ }
The modifier mask is also included in the "modifiers" field in BMessages that report keyboard and mouse events.
How your application uses modifier keys is up to you. The table below lists the eight keys and how they're typically used.
If you're interested in whether the left or right modifer key of a given type was pressed, you can check against these additional values:
B_LEFT_SHIFT_KEY | B_RIGHT_SHIFT_KEY |
B_LEFT_CONTROL_KEY | B_RIGHT_CONTROL_KEY |
B_LEFT_OPTION_KEY | B_RIGHT_OPTION_KEY |
B_LEFT_COMMAND_KEY | B_RIGHT_COMMAND_KEY |
Most of the modifiers map to single, specific keys: Shift and Caps Lock are examples. But others don't: the Menu key maps to Shortcut+Escape (either Alt-Escape, Command-Escape, or Control-Escape, depending on your preferences and the keyboard the user is using).
Keyboard Table of Contents | Keyboard Index |
Copyright © 2000 Be, Inc. All rights reserved..