Original Author Paul Laughton, 2011
Page 100
De Re BASIC!
Input {<prompt_sexp>}, <result_var>{, {<default_exp>}{, <canceled_nvar>}}
Generates a dialog box with an input area and an OK button. When the user taps the button, the value
in the input area is written to the variable <result_var>.
The <prompt_sexp> will become the dialog box title. If the prompt expression is empty ("") or omitted,
the dialog box will be drawn without a title area.
If the return variable <result_var> is numeric, the input must be numeric, so the only key taps that will
be accepted are 0-9, "+", "-" and ".". If <result_var> is a string variable, the input may be any string.
If a <default_exp> is given then its value will be placed into the input area of the dialog box. The default
expression type must match the <result_var> type.
The variable <canceled_nvar> controls what happens if the user cancels the dialog, either by tapping the
BACK key or by touching anywhere outside of the dialog box.
If you provide a <canceled_nvar>, its value is set to false (0) if the user taps the OK button, and true (1)
if the users cancels the dialog.
If you do not provide a <canceled_nvar>, a canceled dialog is reported as an error. Unless there is an
"OnError:" the user will see the messages:
Input dialog cancelled
Execution halted
If there is an "OnError:" label, execution will resume at the statement following the label.
The <result_var> parameter is required. All others are optional. These are all valid:
INPUT "prompt", result$, "default", isCanceled
INPUT , result$, "default"
INPUT "prompt", result$, , isCanceled
INPUT "prompt", result$
INPUT , result$
Note the use of commas as parameter placeholders (see Optional Parameters).
Inkey$ <svar>
Reports key taps for the a-z, 0-9, Space and the D-Pad keys. The key value is returned in <svar>.
The D-Pad keys are reported as "up", "down", "left", "right" and "go". If any key other than those have
been tapped, the string "key nn" will be returned. Where nn will be the Android key code for that key.
If no key has been tapped, the "@" character is returned in <svar>.
Rapid key taps are buffered in case they come faster than the BASIC! program can handle them.