Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - pickadd() add an item to a string list http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 pickadd()           Add an item to a string list
------------------------------------------------------------------------------
 Declaration
   pick.hdr

 Syntax
   proc pickadd extern
   param value _SLIST pList, ;
         const char   cString

 Arguments
   pList is a list pointer.
   cString is a string to add to the list.

 Return
   None.

 Description
   The pickadd() function adds the string item in cString to the list
   structure specified with pList.

   pList is a value previously retrieved by the pickinit() function.
   Passing a value for pList which is not the pointer to an initialized
   list will cause a run-time error.

   cString may contain a hot-key character when the list is to be displayed
   by the pickdisp() function.

   pickadd() automatically reserves additional space for the flags required
   by pickdisp(). The picklist() procedure ignores such flags, so that
   pickadd() can be used together with both functions.

   When using pickadd() to fill the list with items, the item ids are
   set equal to the item order numbers, i. e. the first added item has
   id number 1, the second id number 2, etc. If you want to assign your
   own id numbers to the items, use the pickaddid() procedure instead.
   To ensure that id numbers remain unique, the two procedures should
   not be mixed while adding items to one list.

   This function can only be used with string lists, but not with generic
   lists that contain non-character data.

 Example
   #define EXAMPLE_LIST
   #include example.hdr

   proc Test_pickadd
   // Initialize and execute a File sub-menu with hot-keys
   vardef
      _SLIST pList
      uint   uChoice
   enddef
   pList := pickinit()                              // initialize list
   
   pickadd( pList, "&Open" )                        // add list items
   pickadd( pList, "&New" )
   pickadd( pList, "-" )
   pickadd( pList, "&Save" )
   pickadd( pList, "Save &as..." )
   pickadd( pList, "-" )
   pickadd( pList, "&Print" )
   pickadd( pList, "Setup p&rinter" )
   pickadd( pList, "-" )
   pickadd( pList, "&Quit" )
   
   clear
   uChoice := pickdisp( pList, 1, 5, 10, 20 )       // display list
   @ 12, 0 ?? "Selection was item", istr( uChoice ) // evaluate selection
   pickclear( pList )                               // remove list
   endproc

   proc main
   Test_pickadd()
   endproc

See Also: pickaddid()

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