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

 Syntax
   func int menupromptlen 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 length of the longest prompt text (caption) in the
   specified menu, or -1 in case an invalid menu pointer was passed.

 Description
   This is a utility function that might be called from within menu handlers,
   e.g. to determine the screen area that will be occupied by a sub-menu in
   order to save that screen area before displaying the menu.

   The maximum prompt length takes the hot character setting (adjusted by
   menusethot()) into account. Prompt lengths are calculated at the time
   of adding new prompts to a menu. Therefore, the value returned by the
   menupromptlen() function does not reflect changes in the menusethot()
   setting after prompt creation.

 Example
   #define EXAMPLE_MENU
   #include example.hdr

   proc Test_menupromptlen
   vardef
      _MENU pMenu
   enddef
   
   clear
   
   menusethot( .t. )
   pMenu := menunew()
   
   menupromptnew( pMenu, 5, 10, " &1st ", 1, .t., .t. )
   menupromptnew( pMenu, 6, 10, " This is the &2nd prompt ", 2, .t., .t. )
   menupromptnew( pMenu, 7, 10, " and the &3rd ", 3, .t., .t. )
   menupromptnew( pMenu, 8, 10, " and here is number &4 ", 4, .t., .t. )
   
   ? menupromptlen( pMenu )   // Prints 24 (note that hot-key markers don't
                              // count due to the menusethot( .t .) call).
   
   endproc

   proc main
   Test_menupromptlen()
   endproc

See Also: menucoloffset() menugetpromptlen() menuleftcol() menurowoffset() menutoprow()

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