Get from an array of choices via a menu ──────────────────────────────────────────────────────────────────────────────
Syntax
GT_ChoiceReader( oGet ) @ <row>, <col> GET <var> [...] FROM <aChoices> [....]
Arguments:
Not Applicable
Returns:
Not Applicable
Description:
This is a get reader. It allows the user to choose a value from an array of strings. It correctly handles arrays that are longer than available screen space (see Examples). If the choices menu is too wide for the screen it will generate a meaningful error message The colours cannot be changed at the moment without altering the code. If someone wants to add an optional colours clause see the information about the cargo that follows.
For those who are interested (it is not neccessary to know this to use the reader) the following data is stored in the cargo slot of the reader. oGet:cargo[1] - The array of menu choices oGet:cargo[2] - The current choice (only changes when in the getreader itself) oGet:cargo[3] - Colours array oGet:cargo[3][1] - Normal colour oGet:cargo[3][2] - Selection bar colour oGet:cargo[3][3] - Frame colour
NOTE: this function is not standalone, you also need the following
Examples:
local choices := { "Yes", "No", "Not Sure" } local choices2 := {} local var1 := "" local var2 := "" local i
for i := 1 to 99 aAdd(choices2, "Choice " + str(i, 2)) next
@ 10, 10 say "Choice 1" get var1 from choices @ 10, 50 say "Choice 2" get var2 from choices2