1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
|
<!DOCTYPE html>
<html lang="en" dir="ltr" class="no-js">
<head>
<meta charset="utf-8" />
<title>en:key [BASIC 256 - Language Documentation]</title>
<link rel="stylesheet" type="text/css" href="lib/exe/cssc171c1dfe8519125bb40a349172b001a.css"/>
</head>
<body>
<div id="dokuwiki__site"><div id="dokuwiki__top" class="site dokuwiki mode_show tpl_dokuwiki ">
<div id="dokuwiki__header"><div class="pad group">
<div class="headings group">
<h1><a href="start.html" accesskey="h" title="[H]"><img src="lib/tpl/dokuwiki/images/logo.png" width="64" height="64" alt="" /> <span>BASIC 256 - Language Documentation</span></a></h1>
</div>
</div>
<div class="breadcrumbs">
<div class="youarehere"><span class="bchead">You are here: </span><span class="home"><bdi><a href="start.html" class="wikilink1" title="start">start</a></bdi></span> » <bdi><a href="en_start.html" class="wikilink1" title="en:start">en</a></bdi> » <bdi><span class="curid"><a href="en_key.html" class="wikilink1" title="en:key">key</a></span></bdi></div>
</div>
<hr class="a11y" />
</div></div>
<div class="wrapper group">
<div id="dokuwiki__content"><div class="pad group">
<div class="pageId"><span>en:key</span></div>
<div class="page group">
<div id="dw__toc">
<h3 class="toggle">Table of Contents</h3>
<div>
<ul class="toc">
<li class="level2"><div class="li"><a href="en_key.html#key_function">Key (Function)</a></div>
<ul class="toc">
<li class="level3"><div class="li"><a href="en_key.html#format">Format</a></div></li>
<li class="level3"><div class="li"><a href="en_key.html#description">Description</a></div></li>
<li class="level3"><div class="li"><a href="en_key.html#note">Note</a></div></li>
<li class="level3"><div class="li"><a href="en_key.html#partial_list_of_keys">Partial List of Keys</a></div></li>
<li class="level3"><div class="li"><a href="en_key.html#example">Example</a></div></li>
<li class="level3"><div class="li"><a href="en_key.html#see_also">See Also</a></div></li>
</ul></li>
</ul>
</div>
</div>
<h2 class="sectionedit1" id="key_function">Key (Function)</h2>
<div class="level2">
</div>
<h3 class="sectionedit2" id="format">Format</h3>
<div class="level3">
<p>
key<br/>
key()
</p>
<p>
returns <em><a class="explain" href="en_key.html">positive_integer_value</a></em>
</p>
</div>
<h3 class="sectionedit3" id="description">Description</h3>
<div class="level3">
<p>
Immediately returns an integer value corresponding to the currently pressed keyboard key. If no key has been pressed since the last call to the <strong>key</strong> function then the number zero (0) will be returned. This function returns the code for the key pressed not always the <abbr title="American Standard Code for Information Interchange">ASCII</abbr> value of the character.
</p>
</div>
<h3 class="sectionedit4" id="note">Note</h3>
<div class="level3">
<pre class="code">if key = 47 then print key</pre>
<p>
will not display the desired results, because it's calling key twice in succession, and will return different values each time. This code will do what you want:
</p>
<pre class="code">a = key
if a = 47 then print a</pre>
</div>
<h3 class="sectionedit5" id="partial_list_of_keys">Partial List of Keys</h3>
<div class="level3">
<div class="table sectionedit6"><table class="inline">
<tr class="row0">
<td class="col0">ESC=16777216</td><td class="col1" colspan="7">Space=32</td>
</tr>
<tr class="row1">
<td class="col0">0=48</td><td class="col1">1=49</td><td class="col2">2=50</td><td class="col3">3=51</td><td class="col4">4=52</td><td class="col5">5=53</td><td class="col6">6=54</td><td class="col7">7=55</td>
</tr>
<tr class="row2">
<td class="col0">8=56</td><td class="col1" colspan="7">9=57</td>
</tr>
<tr class="row3">
<td class="col0">A=65</td><td class="col1">B=66</td><td class="col2">C=67</td><td class="col3">D=68</td><td class="col4">E=69</td><td class="col5">F=70</td><td class="col6">G=71</td><td class="col7">H=72</td>
</tr>
<tr class="row4">
<td class="col0">I=73</td><td class="col1">J=74</td><td class="col2">K=75</td><td class="col3">L=76</td><td class="col4">M=77</td><td class="col5">N=78</td><td class="col6">O=79</td><td class="col7">P=80</td>
</tr>
<tr class="row5">
<td class="col0">Q=81</td><td class="col1">R=82</td><td class="col2">S=83</td><td class="col3">T=84</td><td class="col4">U=85</td><td class="col5">V=86</td><td class="col6">W=87</td><td class="col7">X=88</td>
</tr>
<tr class="row6">
<td class="col0">Y=89</td><td class="col1" colspan="7">Z=90</td>
</tr>
<tr class="row7">
<td class="col0">Down Arrow=16777237</td><td class="col1">Up Arrow=16777235</td><td class="col2">Left Arrow=16777234</td><td class="col3" colspan="4">Right Arrow=16777236</td><td class="col7"></td>
</tr>
</table></div>
<p>
<a href="http://qt-project.org/doc/qt-4.8/qt.html#Key-enum" class="urlextern" title="http://qt-project.org/doc/qt-4.8/qt.html#Key-enum" rel="nofollow">Click here for a complete list of key values</a>
</p>
</div>
<h3 class="sectionedit7" id="example">Example</h3>
<div class="level3">
<pre class="code">#press any keys
loop:
pause 1
a = key
print a+" "+chr(a)
goto loop</pre>
</div>
<h3 class="sectionedit8" id="see_also">See Also</h3>
<div class="level3">
</div>
<div class="plugin_include_content plugin_include__en:start">
<div class="level3">
<p>
<a href="en_alert.html" class="wikilink1" title="en:alert">Alert</a>, <a href="en_confirm.html" class="wikilink1" title="en:confirm">Confirm</a>, <a href="en_input.html" class="wikilink1" title="en:input">Input</a>, <span class="curid"><a href="en_key.html" class="wikilink1" title="en:key">Key</a></span>, <a href="en_prompt.html" class="wikilink1" title="en:prompt">Prompt</a>
</p>
</div>
</div>
<div class="level3">
</div>
</div>
<div class="docInfo"><bdi>en/key.txt</bdi> · Last modified: 2014/02/09 20:35 by <bdi>admin</bdi></div>
</div></div>
<hr class="a11y" />
</div>
<div id="dokuwiki__footer"><div class="pad">
<div class="license">Except where otherwise noted, content on this wiki is licensed under the following license: <bdi><a href="http://creativecommons.org/licenses/by-sa/3.0/" rel="license" class="urlextern">CC Attribution-Share Alike 3.0 Unported</a></bdi></div>
</div></div>
</div></div>
<div id="screen__mode" class="no"></div>
</body>
</html>
|