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

 Syntax
   func uint pickhotkey extern
   param value _LIST pList, ;
         value uint  uItem

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

 Return
   The ASCII code of the hot key character.

 Description
   The pickhotkey() function returns the ASCII code of the hot-key character
   in the specified item, or 0 if this item has no hot-key defined.

   Each item in a pick list can contain an optional hot-key character. The
   pickdisp() function displays this character with a special attribute and
   uses the user to select an item by directly typing the hot-key. A hot-key
   is marked with a special lead-in character ('&' by default).

   This function is used by pickdisp() and may be helpful if you want
   to create your own list display routines, or if you want to customize the
   keyboard handler for pickdisp().

   This function is normally used with string lists to be displayed via the
   pickdisp() function.

 Example
   #define EXAMPLE_LIST
   #include example.hdr

   proc Test_pickhotkey
   vardef
      _SLIST pList
   enddef
   pList := pickinit()
   
   pickadd( pList, "&Open" )
   pickadd( pList, "&New" )
   pickadd( pList, "-" )
   pickadd( pList, "&Save" )
   pickadd( pList, "Save &as..." )       // item 5
   pickadd( pList, "-" )
   pickadd( pList, "&Print" )
   pickadd( pList, "Setup p&rinter" )
   pickadd( pList, "-" )                 // item 9
   pickadd( pList, "&Quit" )
   
   ? pickhotkey( pList, 5 )              // output: 97 (that is 'a')
   ? pickhotkey( pList, 9 )              // output:  0 (no hot key)
   
   pickclear( pList )
   endproc

   proc main
   Test_pickhotkey()
   endproc

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