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 - picklist() display a string list http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 picklist()          Display a string list
------------------------------------------------------------------------------
 Declaration
   pick.hdr

 Syntax
   proc picklist extern
   param value _SLIST  pList, ;
         value int     iTop, ;
         value int     iLeft, ;
         value int     iBottom, ;
         value int     iRight, ;
               int     iChoice, ;
         value logical lDisplayOnly, ;
         value logical lReturnOnKey

 Arguments
   pList is a list pointer.

   iTop is the top row for the display.

   iLeft is the leftmost column for the display.

   iBottom is the bottom row for the display.

   iRight is the rightmost column for the display.

   iChoice is the index of the list item selected by the Enter key,
   or 0 if the list display was exited by pressing Escape.

   lDisplayOnly indicates if the function must not wait for keypresses
   after displaying the list.

   lReturnOnKey indicates that the function must return if any key
   other than a cursor movement key is pressed. Setting the parameter to .t.
   allows monitoring other keys while the cursor keys are processed by
   picklist().

 Return
   None.

 Description
   The picklist() procedure displays a list at the specified coordinates,
   and optionally allows the user to navigate in the list using keypresses.
   The picklist() function is not completely re-entrant due to its use of the
   global __tops_ system variable. Use the pickdisp() function instead of
   picklist() for enhanced functionality.

 Example
   #define EXAMPLE_LIST
   #include example.hdr

   vardef static
      logical lShown := .f.
      _SLIST  pList
      int     iValue
   enddef
   
   func int MonthList static
   // Use the "display only" parameter to display a pick list, yet still
   // enter data into a get.
   if lastkey() == K_F2 .and. .not. lShown
      saverc()
      picklist( pList, row() + 2, col(), row() + 14, col() + 12, ;
         iValue, .t., .f.)
      restrc()
      lShown := .t.
   endif
   return lastkey()
   endfunc
   
   proc Test_picklist
   vardef
      char(20) cMonth
   enddef
   pList  := ExampleList()                        // generate and show list
   clear
   picklist( pList, 2, 5, 14, 17, iValue, .f., .f. )  // display list
   clear
   if iValue > 0                                      // if selection was made
      cMonth := substr( pickstr( pList, iValue ), 4, 20 ) // transfer to get
   else
      cMonth := space( 20 )
   endif
   @ 2, 4 ?? "Press F2 to see list again."
   @ 3, 4 say "Month: " get cMonth filter MonthList() // do the get
   read
   pickclear( pList )
   endproc

   proc main
   Test_picklist()
   endproc

See Also: __tops_ pickdisp()

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