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

 Syntax
   func logical menusetlast 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 .f., an invalid menu
   pointer was specified.

 Description
   This function makes the last active prompt in a menu system current. This
   prompt, and the previously current prompt will be automatically redis-
   played with the corresponding new color attributes.

 Example
   #define EXAMPLE_MENU
   #include example.hdr

   proc Test_menusetlast
   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_menusetlast()
   endproc

See Also: menusetfirst() menusetnext() menusetprev()

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