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 - pickkeystd() default keyboard handler for string list display http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 pickkeystd()        Default keyboard handler for string list display
------------------------------------------------------------------------------
 Declaration
   pick.hdr

 Syntax
   func uint pickkeystd extern
   param value _SLIST pList, ;
         value uint   uStatus, ;
               uint   uItemCurr

 Arguments
   pList is a list pointer.
   uStatus is the status of the list display.
   uItemCurr is the current selected list item.

 Return
   Action command.

 Description
   The pickkeystd() function is the default keyboard handler for the
   pickdisp() function. The use of pickkeystd() by pickdisp() can be
   replaced by a customized keyboard handler, installed via the picksetudf()
   function. A custom keyboard handler function must have a prototype
   identical to that of the pickkeystd() function.

   The pickdisp() function sends information to the keyboard handler via the
   uStatus and uItemCurr parameters, and the keyboard handler sends back
   commands and information to pickdisp() via its return value and via the
   uItemCurr reference parameter.

   Status messages passed from pickdisp() to the keyboard handler via the
   uStatus parameter are listed in the List display table.

   Whenever the keyboard handler gets called, the uItemCurr parameter
   contains the id of the current item, i.e. the item marked by the
   selection bar.

   When the keyboard handler terminates, it must return one of the
   predefined commands listed in the List display table.

   In most cases, a keyboard handler should check what status was passed
   from pickdisp(), and then either directly send a command to
   pickdisp(), i.e. return immediately, or read a keyboard character, and
   return the appropriate command to pickdisp().

 Example
   #define EXAMPLE_LIST
   #include example.hdr

   func uint SetRec static       // custom keyboard handler
   param value _SLIST pList, ;   // prototype must be identical
         value uint   uStatus, ; // to that of the pickkeystd() function
               uint   uItemCurr
   @ 0, 70 ?? time()             // display time
   // process keypresses via default function
   return( pickkeystd( pList, uStatus, uItemCurr ) )
   endfunc
   
   proc Test_pickkeystd
   vardef
      _SLIST pList
   enddef
   clear
   pList := pickinit()               // initialize list
   pickadd( pList, "one" )           // add items
   pickadd( pList, "two" )
   picksetudf( pList, &SetRec )      // set up the custom keyboard handler
   pickdisp( pList, 10, 10, 11, 15 ) // show list
   pickclear( pList )                // clear list
   endproc

   proc main
   Test_pickkeystd()
   endproc

See Also: List display table picksetudf() pickudf()

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