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 - menuptr() return a pointer to the default menu http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 menuptr()           Return a pointer to the default menu
------------------------------------------------------------------------------
 Declaration
   menu.hdr

 Syntax
   func _MENU menuptr extern
   param value logical lClear

 Arguments
   lClear defines if the menu shall be cleared from memory.

 Return
   The pointer to the default menu, or 0 if the default menu is not active.

 Description
   This function can either be used to determine the value of the default
   menu pointer ( lClear = .f. ), or to clear the default menu from memory
   ( lClear = .t. ), similar to the clear menu command.

   The first option is useful when a customized menu handler shall have
   access to prompts created by @ prompt commands in the default menu.

 Example
   #define EXAMPLE_MENU
   #include example.hdr

   proc Test_menuptr
   vardef
      _MENU pMenu
      int   iChoice
      uint  uKey
   enddef
   
   clear
   cursor( .f. )
   
   @ 5, 10 prompt " 1st prompt "
   @ 6, 10 prompt " 2nd prompt "
   @ 7, 10 prompt " 3rd prompt "
   @ 8, 10 prompt " 4th prompt "
   
   // Retrieve the default menu
   //
   pMenu = menuptr( .f. )
   
   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
      endcase
   enddo
   
   @ 10, 0 ?? "The selection is:", iChoice
   
   // Clear the menu
   //
   menuptr( .t. )
   
   cursor( .t. )
   
   endproc

   proc main
   Test_menuptr()
   endproc

See Also: menupromptnew()

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