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 - pickstr() return the string associated with a list item http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 pickstr()           Return the string associated with a list item
------------------------------------------------------------------------------
 Declaration
   pick.hdr

 Syntax
   func char pickstr extern
   param value _SLIST pList, ;
         value uint   uItem

 Arguments
   pList is a list pointer.
   uItem is a list item index.

 Return
   List item as character string.

 Description
   This function returns the string associated with the list index value
   uItem. The pList argument is initialized by the pickinit() function.
   Strings are entered in order into a pick list by pickadd(). That is, the
   first string entered is string number 1, the second is string number 2,
   etc..

   The pickstr() function does not filter out hot-key markers (&) contained
   in the returned string, unlike the pickstring() function.

   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_pickstr
   vardef
      _SLIST pList
      uint   uChoice
      uint   uChar
   enddef
   // Get the 4th and 1st element from a pick list.
   //
   pList := pickinit()
   pickadd( pList, "this" )
   pickadd( pList, "is" )
   pickadd( pList, "a" )
   pickadd( pList, "test" )
   
   ? pickstr( pList, 4 ), pickstr( pList, 1 )    // output: this test
   pickclear( pList )
   
   // Get the element with id-# 4 from a pick list.
   //
   pList := pickinit()
   pickaddid( pList, "this", 4 )
   pickaddid( pList, "is",   3 )
   pickaddid( pList, "a",    4 )
   pickaddid( pList, "test", 1 )
   
   ? pickstr( pList, pickseekid( pList, 4 ) )    // output: this
   pickclear( pList )
   wait
   
   // Confirm a user's choice
   //
   clear
   pList := ExampleList()
   uChoice := pickdisp( pList, 0, 40, 5, 55 )
   
   if uChoice != 0
      @ 20, 10 ?? "You selected " + pickstr( pList, uChoice )
      @ 21, 10 ?? "Is this correct? (Y/N)"
      repeat
         uChar := toupper( getkey() )
      until uChar == 'Y' .or. uChar == 'N'
      // do actions depending on user answer
   endif
   
   pickclear( pList )
   endproc

   proc main
   Test_pickstr()
   endproc

See Also: pickstring() pickstrlen()

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