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

 Syntax
   func int menucurrentid extern
   param value _MENU pMenu

 Arguments
   pMenu is the pointer to a previously created menu system. If 0, the
         default menu will be used.

 Return
   An int containing the id of the currently highlighted prompt, or -1 in
   case an invalid menu pointer was specified.

 Description
   This function is usually called from menu handlers to determine the
   selected prompt item.

 Example
   #define EXAMPLE_MENU
   #include example.hdr

   proc Test_menucurrentid
   vardef
      _MENU pMenu
   enddef
   
   clear
   pMenu = menunew()
   menupromptnew( pMenu, 5, 5, " 1st prompt ", 1, .t., .t. )
   menupromptnew( pMenu, 6, 5, " 2nd prompt ", 2, .f., .t. ) // not active
   menupromptnew( pMenu, 7, 5, " 3rd prompt ", 3, .t., .t. )
   menupromptnew( pMenu, 8, 5, " 4th prompt ", 4, .t., .t. )
   
   menusetfirst( pMenu )              // Makes the 1st prompt current
   @ 10, 5 ?? menucurrentid( pMenu )  // Prints 1
   menusetnext( pMenu )               // Makes the 3rd prompt current because
                                      // the 2nd one is not active
   @ 11, 5 ?? menucurrentid( pMenu )  // Prints 3
   menuclear( pMenu )
   
   endproc

   proc main
   Test_menucurrentid()
   endproc

See Also: menupromptnew()

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