8000 Update DEFINEKEY help · chrisws/smallbasic.github.io@75e5226 · GitHub
[go: up one dir, main page]

Skip to content

Commit 75e5226

Browse files
committed
Update DEFINEKEY help
1 parent 10c592b commit 75e5226

File tree

3 files changed

+35
-37
lines changed

3 files changed

+35
-37
lines changed

_build/reference/1015-console-definekey.markdown

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,28 @@
11
# DEFINEKEY
22

3-
> DEFINEKEY k,sub
3+
> DEFINEKEY k, sub
44
5-
Binds a keystroke to a user defined function
5+
Binds a keystroke to a user defined function,
66

77
~~~
8-
98
sub moveLeft
109
if (block.x > 0) then
1110
moveBlock -1, 0
1211
fi
1312
end
1413
defineKey 0xFF04, moveLeft
15-
1614
~~~
1715

18-
~~~
16+
To unbind the keystroke definition pass 0 as the `sub` argument, for example:
17+
18+
19+
```
20+
DEFINEKEY 0xFF04, 0
21+
```
22+
23+
## Example 1:
1924

25+
~~~
2026
' DEFINEKEY demo.bas SmallBASIC 0.12.2 [B+=MGA] 2016-03-30
2127
'remember Etch-A-Sketch?
2228
'definekey key,sub
@@ -80,12 +86,11 @@ end
8086
sub quit
8187
stop
8288
end
83-
8489
~~~
8590

91+
## Example 2:
8692

8793
~~~
88-
8994
' Note:
9095
' * You may Include "definekey_const.bas" file in another file to make your code more clear.
9196
'
@@ -172,7 +177,4 @@ Const DK_MK_RELEASE = 0xFFC3
172177
Const DK_MK_WHEEL = 0xFFC4
173178
Const DK_MK_FIRST = DK_MK_PUSH
174179
Const DK_MK_LAST = DK_MK_WHEEL
175-
176180
~~~
177-
178-

reference/1015.html

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,17 @@ <h1>DEFINEKEY</h1>
7575
</p>
7676
</div>
7777
</blockquote>
78-
<p>Binds a keystroke to a user defined function</p>
79-
<pre><code>
80-
sub moveLeft
78+
<p>Binds a keystroke to a user defined function,</p>
79+
<pre><code>sub moveLeft
8180
if (block.x &gt; 0) then
8281
moveBlock -1, 0
8382
fi
8483
end
85-
defineKey 0xFF04, moveLeft
86-
</code></pre>
87-
<pre><code>
88-
&#39; DEFINEKEY demo.bas SmallBASIC 0.12.2 [B+=MGA] 2016-03-30
84+
defineKey 0xFF04, moveLeft</code></pre>
85+
<p>To unbind the keystroke definition pass 0 as the <code>sub</code> argument, for example:</p>
86+
<pre><code>DEFINEKEY 0xFF04, 0</code></pre>
87+
<h2 id="example-1">Example 1:</h2>
88+
<pre><code>&#39; DEFINEKEY demo.bas SmallBASIC 0.12.2 [B+=MGA] 2016-03-30
8989
&#39;remember Etch-A-Sketch?
9090
&#39;definekey key,sub
9191
&#39;example:
@@ -147,10 +147,9 @@ <h1>DEFINEKEY</h1>
147147
end
148148
sub quit
149149
stop
150-
end
151-
</code></pre>
152-
<pre><code>
153-
&#39; Note:
150+
end</code></pre>
151+
<h2 id="example-2">Example 2:</h2>
152+
<pre><code>&#39; Note:
154153
&#39; * You may Include &quot;definekey_const.bas&quot; file in another file to make your code more clear.
155154
&#39;
156155
&#39; * Created using SmallBASIC version 0.12.2 (on Linux Mint 17.3).
@@ -235,8 +234,7 @@ <h1>DEFINEKEY</h1>
235234
Const DK_MK_RELEASE = 0xFFC3
236235
Const DK_MK_WHEEL = 0xFFC4
237236
Const DK_MK_FIRST = DK_MK_PUSH
238-
Const DK_MK_LAST = DK_MK_WHEEL
239-
</code></pre>
237+
Const DK_MK_LAST = DK_MK_WHEEL</code></pre>
240238
<div class="lavenderBox">
241239
<div class="header">Code samples using DEFINEKEY</div>
242240
<div class="linklist">

reference/ide/1015.html

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<h1 id="definekey">DEFINEKEY</h1>
22
<blockquote>
3-
<p>DEFINEKEY k,sub</p>
3+
<p>DEFINEKEY k, sub</p>
44
</blockquote>
5-
<p>Binds a keystroke to a user defined function</p>
6-
<pre><code>
7-
sub moveLeft
5+
<p>Binds a keystroke to a user defined function,</p>
6+
<pre><code>sub moveLeft
87
if (block.x &gt; 0) then
98
moveBlock -1, 0
109
fi
1110
end
12-
defineKey 0xFF04, moveLeft
13-
</code></pre>
14-
<pre><code>
15-
&#39; DEFINEKEY demo.bas SmallBASIC 0.12.2 [B+=MGA] 2016-03-30
11+
defineKey 0xFF04, moveLeft</code></pre>
12+
<p>To unbind the keystroke definition pass 0 as the <code>sub</code> argument, for example:</p>
13+
<pre><code>DEFINEKEY 0xFF04, 0</code></pre>
14+
<h2 id="example-1">Example 1:</h2>
15+
<pre><code>&#39; DEFINEKEY demo.bas SmallBASIC 0.12.2 [B+=MGA] 2016-03-30
1616
&#39;remember Etch-A-Sketch?
1717
&#39;definekey key,sub
1818
&#39;example:
@@ -74,10 +74,9 @@ <h1 id="definekey">DEFINEKEY</h1>
7474
end
7575
sub quit
7676
stop
77-
end
78-
</code></pre>
79-
<pre><code>
80-
&#39; Note:
77+
end</code></pre>
78+
<h2 id="example-2">Example 2:</h2>
79+
<pre><code>&#39; Note:
8180
&#39; * You may Include &quot;definekey_const.bas&quot; file in another file to make your code more clear.
8281
&#39;
8382
&#39; * Created using SmallBASIC version 0.12.2 (on Linux Mint 17.3).
@@ -162,5 +161,4 @@ <h1 id="definekey">DEFINEKEY</h1>
162161
Const DK_MK_RELEASE = 0xFFC3
163162
Const DK_MK_WHEEL = 0xFFC4
164163
Const DK_MK_FIRST = DK_MK_PUSH
165-
Const DK_MK_LAST = DK_MK_WHEEL
166-
</code></pre>
164+
Const DK_MK_LAST = DK_MK_WHEEL</code></pre>

0 commit comments

Comments
 (0)
0