Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- GT_LIB v1.0 Reference Guide Release 1.0 - <b>get from an array of choices via a menu</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 Get from an array of choices via a menu
------------------------------------------------------------------------------

 Syntax

        @ <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
            functions from the GTLIB - GT_AComp(), GT_SaveScr() and
            GT_RestScr()


 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

      GT_Read(getlist)


 Source: GETCHOIC.PRG

 Author:  Andy M Leighton

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson