Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Harbour Version 0.37 (c) reference Guid - Norton Guide http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]

MENU TO

Invoked a menu defined by set of @...PROMPT
---------------------------------------------------------------------------------

 Syntax

        MENU TO <cVariable>  

 Arguments

        <cVariable>   is a character string that contain the name of 
                  the variable to hold the menu choices, if this variable
                  does not exist  a PRIVATE variable with the name
                  <cVariable> would be created to  hold the result.

 Returns

       Menu  To return the number of select menu item, or 0 if there was no 
                  item to select from or if the user pressed the Esc key.

 Description

      Menu To() invoked the menu define by previous __AtPrompt() call  and
      display a highlight bar that the user can move to select an  option
      from the menu. If <cVariable> does not exist or not visible,  a
      PRIVATE variable named <cVariable> is created and hold the current
      menu selection. If there is a variable named <cVariable>, its value
      is used to select the first highlighted item.

      Menu prompts and messages are displayed in current Standard color,
      highlighted bar is displayed using current Enhanced color.

      Pressing the arrow keys move the highlighted bar. When a menu item
      is highlighted the message associated with it is displayed on the
      line specified with SET MESSAGE. If SET WRAP is ON and the user
      press UP arrow while on the first selection the last menu item is
      highlighted, if the user press Down arrow while on the last item,
      the first item is highlighted.

      Following are active keys that handled by Menu To:
      -----------------------------------------------------

      +---------------------------------------------------------------+
      | key          | Meaning                                        |
      |--------------+------------------------------------------------|
      | Up           | - Move to previous item                        |
      | Down         | - Move to next item                            |
      | Left         | - Move to previous item                        |
      | Right        | - Move to next item                            |
      | Home         | - Move to the first item                       |
      | End          | - Move to the last item                        |
      | Page-Up      | - Select menu item, return position            |
      | Page-Down    | - Select menu item, return position            |
      | Enter        | - Select menu item, return position            |
      | Esc          | - Abort selection, return 0                    |
      | First letter | - Select next menu with the same first letter, |
      | |            | return this item position.                     |
      +---------------------------------------------------------------+
      upon exit the cursor is placed at MAXROW()-1, 0  Menu To can be
      nested without loosing the previous prompts.

      MENU TO command is preprocessed into __MenuTo() function during
      compile time.

 Examples

      // display menu item on each screen corner and let user select one
      CLS
      SET MESSAGE TO MAXROW()/2 CENTER
      SET WRAP ON
      @ 0,         0           PROMPT "1. Upper left"   MESSAGE " One "
      @ 0,         MAXCOL()-16 PROMPT "2. Upper right"  MESSAGE " Two "
      @ MAXROW()-1,MAXCOL()-16 PROMPT "3. Bottom right" MESSAGE "Three"
      @ MAXROW()-1,0           PROMPT "4. Bottom left"  MESSAGE "Four "
      MENU TO nChoice
      SETPOS ( MAXROW()/2, MAXCOL()/2 - 10 )
      if nChoice == 0
         ?? "Esc was pressed"
      else
         ?? "Selected option is", nChoice
      endif
  

Status

      Ready

 Compliance

      This command is CA Clipper compliant



See Also: ACHOICE() SET MESSAGE SET INTENSITY SET WRAP

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