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

 Syntax
   func _MENU menugetsub extern
   param value _MENU pMain, ;
         value int   iId

 Arguments
   pMain is the pointer to the main menu system.
   iId   is the id number of the prompt.

 Return
   The pointer to the submenu linked to the specified prompt, or 0 if no
   submenu is linked, an invalid menu pointer or id was specified.

 Description
   This is a utility function that might be called from within menu handlers
   to test if a submenu is linked to a prompt item, and to retrieve the
   submenu pointer if this is the case.

 Example
   #define EXAMPLE_MENU
   #include example.hdr

   proc Test_menugetsub
   vardef
      _MENU pMenu, pSubMenu
   enddef
   
   clear
   
   pMenu := menunew()
   
   menupromptnew( pMenu, 2, 10, " Option 1 ", 1, .t., .f. )
   menupromptnew( pMenu, 2, 21, " Option 2 ", 2, .t., .f. )
   
   pSubMenu := menunew()
   
   menupromptnew( pSubMenu, 3, 10, " Sub 1 ", 1, .t., .f. )
   menupromptnew( pSubMenu, 4, 10, " Sub 2 ", 2, .t., .f. )
   menupromptnew( pSubMenu, 5, 10, " Sub 3 ", 3, .t., .f. )
   menupromptnew( pSubMenu, 6, 10, " Sub 4 ", 4, .t., .f. )
   
   menusetsub( pMenu, 1, pSubMenu )
   ? menugetsub( pMenu, 1 )  // Prints some number
   ? menugetsub( pMenu, 2 )  // Prints 0, i.e. no sub-menu is
                             // linked
   
   menuclear( pMenu )        // Clears the menu and the sub-menu
   
   endproc

   proc main
   Test_menugetsub()
   endproc

See Also: menusetsub()

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