Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- FreshWin (c) Fresh Technologies - <b>msmenuto() mouse function</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  MSMENUTO()                                                  Mouse Function
 Purpose..: Replace the Clipper MENU...TO command
-------------------------------------------------------------------------------
 Syntax...: MsMenuTo( <nPos>, [<aExitArea>], [<aExitKeys>]  ;
                       [<cMnuVar>], [<uWin>] ) --> nPos

 Arguments: <nPos>        = menu item to highlight initially.

            [<aExitArea>] = array of co-ordinates which
                            serves as a hot area for exit.

            [<aExitKeys>] = array of exit keys which
                            allows you to define additional keys
                            to exit to menu.

            [<cMnuVar>]   = variable to assign result.

            [<uWin>]      = the string identifier of the window
                            OR the reference to the window structure
                            returned as an array by wNew() or wArray().
                            If not passed, the function will operate on
                            the window in focus.

 Returns..: nPos is the menu item chosen.

 Remark...: The function, MsMenuTo(), is used in a manner
            which parallels the use of MsAtPrompt() which replaces
            the @...PROMPT command. The latter function call displays
            the light-bar menu system. Then the light-bar menu is
            invoked with the use of the command, MsMenuTo().
            MsMenuTo() navigates the current list of menu items
            in the order they were defined. If defined, it will
            start elsewhere like MENU..TO. As you know,
            up to 32 menu items can be defined for each menu.

            In addition to using the arrow keys, the Tab key
            is active for moving about the menu.

            The function can be used with a mouse.

 Source...: MSMENU.PRG
-------------------------------------------------------------------------------
 Example..: . The example sets up an array of prompts
              and displays them in traditional menu fashion.
              But first, you should consider the translated
              #xcommand which follows. It can be found in FW_MENU.CH.

              #xcommand MENU TO <n> [ESCAPE REGION <x>, <y>, <xx>, <yy>];
                                    [EXITKEYS <aExitKeys>]              ;
                                    [<win:IN WINDOW>]                   ;
                       => ;
                     <n> := MsMenuTo( <n>,                      ;
                                      { <x>, <y>, <xx>, <yy> }, ;
                                      [<aExitKeys>],            ;
                                      #<n>,                     ;
                                      iif( <.win.>, wOnTop(), NIL ) )

                . The example still needs a do case...endcase.

   local aPrompt := { { " New York      " , ;
                        " Los Angeles   " , ;
                        " Tucson        " , ;
                        " New Orleans   " , ;
                        " San Francisco " , ;
                        " Kapuskasing   " , ;
                        " Vancouver     " , ;
                        " London        " },;
                        { 6,6,2,2,6,2,2,2 } }

   while !empty( nPick )

      // Create achoice() window to pick a city
      wOpen ( "MnuWin" )

      for n = 1 to len( aPrompt[1] )
         @  wRow( ,n-1 ), wCol( ,0 ) PROMPT   aPrompt[1][n];
                                     COLOR    "W+/*B,W+/R" ;
                                     HOTKEY   aPrompt[2][n];
                                     HOTCOLOR "GR+/B*,GR+/R"
      next

      MENU TO nPick IN WINDOW

      wClose( "MnuWin" )
      do case
      ...

See Also: MsAtPrompt()

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