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

 Syntax
   func logical menuiswrap extern

 Arguments
   None.

 Return
   A logical indicating the current status of the global wrap mode.

 Description
   This is a utility function that might be called from within menu handlers
   to allow wrapping only if the menuwrap flag is set.

 Example
   #define EXAMPLE_MENU
   #include example.hdr

   proc Test_menuiswrap
   vardef
      _MENU pMenu
      uint  uKey
      int   iChoice
   enddef
   
   cursor( .f. )
   clear
   
   menusetwrap( .f. )
   pMenu := menunew()
   
   menupromptnew( pMenu, 2, 10, " Option 1 ", 1, .t., .t. )
   menupromptnew( pMenu, 3, 10, " Option 2 ", 2, .t., .t. )
   menupromptnew( pMenu, 4, 10, " Option 3 ", 3, .t., .t. )
   menupromptnew( pMenu, 5, 10, " Option 4 ", 4, .t., .t. )
   @ 7, 10 ?? "Press F10 to turn the wrap mode on"
   
   do while .t.
      uKey := toupper( getkey() )
      do case
      case uKey == K_F10
         menusetwrap( .not. menuiswrap() )
         if menuiswrap()
            @ 7, 42 ?? "off"
         else
            @ 7, 42 ?? "on "
         endif
      case uKey == K_UP
         if .not. menusetprev( pMenu ) .and. menuiswrap()
            menusetlast( pMenu )
         endif
      case uKey == K_DOWN
         if .not. menusetnext( pMenu ) .and. menuiswrap()
            menusetfirst( pMenu )
         endif
      case uKey == K_ENTER
         iChoice := menucurrentid( pMenu )
         exit
      case uKey == K_ESC
         iChoice := 0
         exit
      endcase
   enddo
   
   @ 10, 0 ?? "The selection is:", iChoice
   
   menuclear( pMenu )
   cursor( .t. )
   
   endproc

   proc main
   Test_menuiswrap()
   endproc

See Also: menusetwrap()

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