Prev: Invoking help
Navigating through patterns
If you select an item from the help by pressing or the confirm key, it is inserted into the code. Its variable parts (arguments) are then quoted between « and » ("french quotes").
If there are such arguments at or after the cursor, pressing the confirm key in the editor (Jog Dial on UIQ) gets a different meaning: it selects the entire argument, thus allowing to:
- simply replace it by characters you type,
- remove it by pressing the delete or backspace key,
- retain it without quotes by pressing the confirm key again.
This feature significantly reduces the number of keystrokes required to enter code: let's assume you have continued writing the code fragment to draw text, and now want to add an
if-then-else construct to color the text, alternating between red and green:
use graph as g
for i=1 to 10 do
if
g.text(10, 15*i, "i="+i)
end
|
Invoking help with the cursor after "if" will display the following help screen:
 | |  |
| Series 60 sample screen | | UIQ sample screen |
Pressing inserts this skeleton into the code. Note that the first argument «expr» is already selected, so you can immediately replace it: type i%2=1, then press confirm to select «statements». Replace it by typing g.pen(g.red), maybe using help again.
 | |  |
| Series 60 sample screen | | UIQ sample screen |
Pressing confirm again selects the entire "elsif" clause. We don't need it, so press the delete key.
Pressing confirm again selects the entire "else" clause. We want it to select a different color if i%2#1, so press confirm to just remove the quotes. This also selects «statements». Replace it by g.pen(g.green).
The final code now looks as follows:
use graph as g
for i=1 to 10 do
if i%2=1 then
g.pen(g.red)
else
g.pen(g.green)
end;
g.text(10, 15*i, "i="+i)
end
|
It is a good idea to practice a little bit with the help system, in particular with the argument selection feature. Also, browsing through the default help gives you an overview of the language constructs supported by help.
Next: m Runtime Errors (Exceptions)© 2004-2011 airbit AG, CH-8008 Zürich
Document AB-M-TUT-887