haiku-website/static/legacy-docs/bebook/TheKeyboard_ModifierKeys.html

34 lines
8.0 KiB
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>The Be Book - Special Topics - The Keyboard</title><link rel="stylesheet" href="be_book.css" type="text/css" media="all" /><link rel="shortcut icon" type="image/vnd.microsoft.icon" href="./images/favicon.ico" /><!--[if IE]>
<link rel="stylesheet" type="text/css" href="be_book_ie.css" />
<![endif]--><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content="Access, BeOS, BeBook, API" /><link rel="start" href="index.html" title="The Be Book" /><link rel="up" href="TheKeyboard.html" title="The Keyboard" /><link rel="prev" href="TheKeyboard_Definitions.html" title="Definitions" /><link rel="next" href="TheKeyboard_MoreOnKeyboardMapping.html" title="More On Keyboard Mapping" /></head><body><div id="header"><div id="headerT"><div id="headerTL"><a accesskey="p" href="TheKeyboard_Definitions.html" title="Definitions"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a accesskey="u" href="TheKeyboard.html" title="The Keyboard"><img src="./images/navigation/up.png" alt="Up" /></a> <a accesskey="n" href="TheKeyboard_MoreOnKeyboardMapping.html" title="More On Keyboard Mapping"><img src="./images/navigation/next.png" alt="Next" /></a></div><div id="headerTR"><div id="navigpeople"><a href="http://www.haiku-os.org"><img src="./images/People_24.png" alt="haiku-os.org" title="Visit The Haiku Website" /></a></div><div class="navighome" title="Home"><a accesskey="h" href="index.html"><img src="./images/navigation/home.png" alt="Home" /></a></div><div class="navigboxed" id="navigindex"><a accesskey="i" href="ClassIndex.html" title="Index">I</a></div><div class="navigboxed" id="naviglang" title="English">en</div></div><div id="headerTC">The Be Book - Special Topics - The Keyboard</div></div><div id="headerB">Prev: <a href="TheKeyboard_Definitions.html">Definitions</a>  Up: <a href="TheKeyboard.html">The Keyboard</a>  Next: <a href="TheKeyboard_MoreOnKeyboardMapping.html">More On Keyboard Mapping</a></div><hr /></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h2 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="TheKeyboard_ModifierKeys"></a>Modifier Keys</h2></div></div></div><p>Conceptually, there are eight modifier keys. The global
<a class="link" href="TheInputServer_Functions.html#modifiers" title="modifiers()"><code class="function">modifiers()</code></a>
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
<a class="link" href="TheInputServer_Functions.html#modifiers" title="modifiers()"><code class="function">modifiers()</code></a>
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
<span class="keycap">Shift</span> keys:</p><pre class="programlisting example c">if (<code class="function">modifiers()</code> | <code class="constant">B_SHIFT_KEY</code>) {
<span class="comment">/* a shift key is down */</span>
}</pre><p>The modifier mask is also included in the "modifiers" field in
<a class="link" href="BMessage.html" title="BMessage"><code class="classname">BMessage</code></a>s
that report keyboard and mouse events.</p><p>How your application uses modifier keys is up to you. The list below
lists the eight keys and how they're typically used.</p><table class="variablelist constants"><thead><tr><th>Constant</th><th>Description</th></tr></thead><tbody><tr><td><p><span class="term"><code class="constant">B_SHIFT_KEY</code></span></p></td><td><p>Maps character keys to their uppercase or alternative
versions.</p></td></tr><tr><td><p><span class="term"><code class="constant">B_COMMAND_KEY</code></span></p></td><td><p>In combination with a character key, performs a keyboard
shortcut.</p></td></tr><tr><td><p><span class="term"><code class="constant">B_CONTROL_KEY</code></span></p></td><td><p>Turns alphabetic keys into control characters.</p></td></tr><tr><td><p><span class="term"><code class="constant">B_OPTION_KEY</code></span></p></td><td><p>Maps keys to alternative characters, typically characters in
an extended set—multibyte <acronym class="acronym">UTF-8</acronym> characters.</p></td></tr><tr><td><p><span class="term"><code class="constant">B_MENU_KEY</code></span></p></td><td><p>Pops open a menu.</p></td></tr><tr><td><p><span class="term"><code class="constant">B_CAPS_LOCK</code></span></p></td><td><p>Reverses the effect of the <span class="keycap">Shift</span> key on alphabetic characters.</p></td></tr><tr><td><p><span class="term"><code class="constant">B_NUM_LOCK</code></span></p></td><td><p>Reverses the effect of the <span class="keycap">Shift</span> key on numeric characters.</p></td></tr><tr><td><p><span class="term"><code class="constant">B_SCROLL_LOCK</code></span></p></td><td><p>Stops the display from scrolling.</p></td></tr></tbody></table><p>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:</p><pre class="screen"><code class="constant">B_LEFT_SHIFT_KEY</code> <code class="constant">B_RIGHT_SHIFT_KEY</code>
<code class="constant">B_LEFT_CONTROL_KEY</code> <code class="constant">B_RIGHT_CONTROL_KEY</code>
<code class="constant">B_LEFT_OPTION_KEY</code> <code class="constant">B_RIGHT_OPTION_KEY</code>
<code class="constant">B_LEFT_COMMAND_KEY</code> <code class="constant">B_RIGHT_COMMAND_KEY</code></pre><p>Most of the modifiers map to single, specific keys:
<span class="keycap">Shift</span> and <span class="keycap">Caps Lock</span>
are examples. But others don't: the <span class="keycap">Menu</span> key maps to
<em class="replaceable"><code>Shortcut</code></em>+<span class="keycap">Escape</span>
(where <em class="replaceable"><code>Shortcut</code></em> is either <span class="keycap">Alt</span>, <span class="keycap">Command</span>,
or <span class="keycap">Control</span>, depending on the
user's preferences and keyboard).</p></div><div id="footer"><hr /><div id="footerT">Prev: <a href="TheKeyboard_Definitions.html">Definitions</a>  Up: <a href="TheKeyboard.html">The Keyboard</a>  Next: <a href="TheKeyboard_MoreOnKeyboardMapping.html">More On Keyboard Mapping</a> </div><div id="footerB"><div id="footerBL"><a href="TheKeyboard_Definitions.html" title="Definitions"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a href="TheKeyboard.html" title="The Keyboard"><img src="./images/navigation/up.png" alt="Up" /></a> <a href="TheKeyboard_MoreOnKeyboardMapping.html" title="More On Keyboard Mapping"><img src="./images/navigation/next.png" alt="Next" /></a></div><div id="footerBR"><div><a href="http://www.haiku-os.org"><img src="./images/People_24.png" alt="haiku-os.org" title="Visit The Haiku Website" /></a></div><div class="navighome" title="Home"><a accesskey="h" href="index.html"><img src="./images/navigation/home.png" alt="Home" /></a></div></div><div id="footerBC"><a href="http://www.access-company.com/home.html" title="ACCESS Co."><img alt="Access Company" src="./images/access_logo.png" /></a></div></div></div><div id="licenseFooter"><div id="licenseFooterBL"><a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/" title="Creative Commons License"><img alt="Creative Commons License" style="border-width:0" src="https://licensebuttons.net/l/by-nc-nd/3.0/88x31.png" /></a></div><div id="licenseFooterBR"><a href="./LegalNotice.html">Legal Notice</a></div><div id="licenseFooterBC"><span id="licenseText">This work is licensed under a
<a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/">Creative
Commons Attribution-Non commercial-No Derivative Works 3.0 License</a>.</span></div></div></body></html>