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 - pickseekid() find the order number of a list item by id number http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 pickseekid()        Find the order number of a list item by id number
------------------------------------------------------------------------------
 Declaration
   pick.hdr

 Syntax
   func uint pickseekid extern
   param value _LIST pList, ;
         value uint  uId

 Arguments
   pList is a list pointer.
   uItem is a list item identifier number.

 Return
   Index (order number) of the list item, or 0 if the id number is not found.

 Description
   The pickseekid() function returns the order number of the item with the
   specified identifier number.

   pickseekid() searches through the specified list for the first item which
   has the specified uId (defined when the item was added via pickaddid()).
   If the item is found, the function returns the item's order number, or 0
   if no item could be found.

 Example
   #define EXAMPLE_LIST
   #include example.hdr

   #define ID_WHINE        331
   #define ID_BEER         432
   #define ID_BRANDY       103
   #define ID_SOFT          34
   #define ID_WATER          5
   
   proc Test_pickseekid
   vardef
      _SLIST pList
      uint   uDrink
   enddef
   
   pList := pickinit()
   
   pickaddid( pList, "&Whine",  ID_WHINE  )
   pickaddid( pList, "&Beer",   ID_BEER   )
   pickaddid( pList, "B&randy", ID_BRANDY )
   pickaddid( pList, "-",       0         )
   pickaddid( pList, "&Soft",   ID_SOFT   )
   pickaddid( pList, "Wa&ter",  ID_WATER  )
   
   uDrink := pickdisp( pList, 10, 20, 15, 25 )
   
   // Translate the id returned from pickdisp() into an order number
   // for pickstring()
   //
   if uDrink > 0
      ? "Your choice:", pickstring( pList, pickseekid( pList, uDrink ) )
   endif
   pickclear( pList )
   endproc

   proc main
   Test_pickseekid()
   endproc

See Also: pickid()

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