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 - menusetprev() make the previous prompt in a menu current http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 menusetprev()       Make the previous prompt in a menu current
------------------------------------------------------------------------------
 Declaration
   menu.hdr

 Syntax
   func logical menusetprev 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
   A logical indicating the success of this function. If .t., the prompt
   could be made current, if .f., an invalid menu pointer was specified, or
   the current prompt is the first active one in the menu.

 Description
   This function makes the first available active prompt in a menu system
   current that preceeds the momentarily current item. This prompt, and the
   previously current prompt will be automatically redisplayed with the
   corresponding new color attributes.

 Example
   #define EXAMPLE_MENU
   #include example.hdr

   proc Test_menusetprev
   vardef
      _MENU pMenu
      uint  uKey
   enddef
   
   cursor( .f. )
   clear
   
   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. )
   
   @ 8, 10 ?? "Press Up/Down to navigate, Esc to quit"
   
   do while .t.
   
      uKey := getkey()
   
      do case
      case uKey == K_DOWN
         if .not. menusetnext( pMenu )
            menusetfirst( pMenu )
         endif
      case uKey == K_UP
         if .not. menusetprev( pMenu )
            menusetlast( pMenu )
         endif
      case uKey == K_ESC
         exit
      endcase
   
   enddo
   
   menuclear( pMenu )
   cursor( .t. )
   clear
   
   endproc

   proc main
   Test_menusetprev()
   endproc

See Also: menusetfirst() menusetlast() menusetnext()

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