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

 Syntax
   func logical menuishot extern

 Arguments
   None.

 Return
   A logical indicating the current status of the global hot-key mode.

 Description
   This is a utility function that might be called from within menu handlers,
   e.g. to accept alphanumeric entries only if the hot-key mode is on.

 Example
   #define EXAMPLE_MENU
   #include example.hdr

   func uint MyMenu
   param _MENU pMenu
   
   vardef
      uint  uKey
      int   iChoice
   enddef
   
   menudispall( pMenu )
   do while .t.
      uKey := toupper( getkey() )
      do case
      case uKey == K_UP
        menusetprev( pMenu )
      case uKey == K_DOWN
        menusetnext( pMenu )
      case uKey == K_ENTER
        iChoice := menucurrentid( pMenu )
        exit
      case uKey == K_ESC
        iChoice := 0
        exit
      case menuishot() .and. uKey >= 'A' .and. uKey <= 'Z'
        iChoice := menufindhot( pMenu, uKey )
        if iChoice > 0
           exit
        endif
      endcase
   enddo
   
   return iChoice
   endfunc
   
   proc Test_menuishot
   vardef
      _MENU pMenu
      uint  uSelect
   enddef
   
   cursor( .f. )
   clear
   
   pMenu := menunew()
   menusethot( .t. )
   menupromptnew( pMenu, 2, 10, " Opt&ion 1 ", 1, .t., .t. )
   menupromptnew( pMenu, 3, 10, " Op&tion 2 ", 2, .t., .t. )
   menupromptnew( pMenu, 4, 10, " Op&tion 3 ", 3, .t., .t. )
   menupromptnew( pMenu, 5, 10, " Optio&n 4 ", 4, .t., .t. )
   
   uSelect := MyMenu( pMenu )
   @ 10, 0 ?? "The selection is:", uSelect
   
   // Note that the '&' characters are now visible, and that the prompts
   // cannot be selected via hot-keys.
   //
   menusethot( .f. )
   uSelect := MyMenu( pMenu )
   @ 10, 0 ?? "The selection is:", uSelect
   
   menuclear( pMenu )
   
   cursor( .t. )
   
   endproc

   proc main
   Test_menuishot()
   endproc

See Also: menusethot()

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