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

 Syntax
   proc menusetwrap extern
   param value logical lSet

 Arguments
   lSet is the desired wrap mode.

 Return
   Nothing.

 Description
   This function controls the wrap mode of menus. If on (the default),
   standard menu handlers automatically make the first active prompt current
   when the user presses the down- or right-arrow keys with the last active
   prompt current. Vice versa, if the user presses the up- or left-arrow keys
   with the first active prompt current, the last active prompt in the menu
   will automatically become current.

 Example
   #define EXAMPLE_MENU
   #include example.hdr

   proc Test_menusetwrap
   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_menusetwrap()
   endproc

See Also: menuiswrap()

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