Harbour Reference Guide

 

__MenuTo()

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

Syntax

__MenuTo( <bBlock>, <cVariable> ) --> nChoice

Arguments

<bBlock> is a set/get code block for variable named <cVariable>.

<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

__MenuTo() 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

__MenuTo() 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 __MenuTo(): -----------------------------------------------------

keyMeaning
UpMove to previous item
DownMove to next item
LeftMove to previous item
RightMove to next item
HomeMove to the first item
EndMove to the last item
Page-UpSelect menu item, return position
Page-DownSelect menu item, return position
EnterSelect menu item, return position
EscAbort selection, return 0
First letterSelect next menu with the same first letter,
|return this item position.
upon exit the cursor is placed at MAXROW()-1, 0 __MenuTo() 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

Files

Library is rtl

See Also

 




[Source Forge]

Other Docs Categories

Advantage Database RDD
Array
Binary conversion
Classes
Code Block
Console input
Conversion
Conversion Tools
DOS
Data input and output
Database
Database Tools
Date
Dos Tools
Environment
Error recovery
Events
File management
GT
Harbour Tools
Internal
Low Level
Math
Misc
Miscellaneous
Nation
Object manipulation
Operating System Specific
Parameter Checks
String Tools
Strings
TBrowse Method
TBrowse class
Terminal
Time
Utility
Variable Management

 

Last updated on 2001/06/26