Command @...PROMPT Foundation

Displays a menu item and an optional descriptive message.

Syntax
@ <nRow>, <nCol> PROMPT <cMenuItem> ;
               [MESSAGE <bcMessage>]
Parameters
<nRow>
<nRow> specifies the screen row at which the menu item is displayed.
<nCol>
<nCol> specifies the screen column at which the menu item is displayed.
<cMenuItem>
<cMenuItem> is the character string displayed as the menu item.
<bcMessage>
<bcMessage> is a character string displayed as a message in the screen row defined by SET MESSAGE when the menu item is highlighted. Instead of a character string, a code block returning a character string can be specified for <bcMessage>.
Description

The command @...PROMPT defines menu items and matching messages. The messages are displayed at the screen row specified with SET MESSAGE. A menu defined using @...PROMPT is activated by the command MENU TO which allows the user to make a menu selection. The menu items are displayed in the order they were defined with the command @...PROMPT. The menu item currently selected is displayed in the "highlighted" color (second color value) of the system color set with SetColor(). The other menu items are output in the default color (first color value).

After a menu item is displayed using @...PROMPT, the cursor is located immediately after the last character of <cMenuItem>, and the functions Row() and Col() return the corresponding values for the row and column positions. The user can jump directly to a menu item by pressing the first letter character of <cMenuItem> during menu execution. If SET WRAP is turned ON and the user attempts to move the highlight past the last menu item, the first menu item is highlighted. The reverse occurs if the user tries to move up from the first menu item.

Examples
@...PROMPT

// In the example, a horizontal menu is shown which outputs 
// three menu items on the uppermost screen row and displays 
// the corresponding messages centered in the bottom row. 

PROCEDURE Main 
   LOCAL nMenuItem := 1 

   CLS 
   SetColor( "N/BG,W+/B" ) 
   @ 0, 0                  // fill first row with blank spaces 

   SET WRAP ON 
   SET MESSAGE TO MaxRow() CENTER 

   @ 0, 1 PROMPT " DBF file " ; 
          MESSAGE "Open and close DBF files" 

   @ Row(), Col()  PROMPT " NTX file " ; 
                   MESSAGE "Open and close index files" 

   @ Row(), Col()  PROMPT " Find " ; 
                   MESSAGE "Find records" 

   MENU TO nMenuItem 

   DO CASE 
   CASE nMenuItem == 0 
      ? "Terminated without selection" 
   CASE nMenuItem == 1 
      ? "DBF file selected" 
   CASE nMenuItem == 2 
      ? "Index file selected" 
   CASE nMenuItem == 3 
      ? "Find record" 
   ENDCASE 
RETURN 
@...PROMPT with MESSAGE code block
// In this example, the same menu shown in the previous 
// example is programmed. It differs in that code blocks 
// that pass the message text to a function are used for 
// MESSAGE. The message is output in multiple lines and 
// in a different color using MemoEdit(). 

PROCEDURE Main 
   LOCAL nMenuItem := 1 

   CLS 
   SetColor( "N/BG,W+/B" ) 
   @ 0, 0                  // fill first row with blank spaces 

   SET WRAP ON 
   SET MESSAGE TO MaxRow() CENTER 

   @ 0, 1 PROMPT " DBF file " ; 
         MESSAGE {|| TextShow("Open and close DBF files") } 

   @ Row(), Col()  PROMPT " NTX file " ; 
         MESSAGE {|| TextShow("Open and close index files") } 

   @ Row(), Col()  PROMPT " Find " ; 
         MESSAGE {|| TextShow("Find records") } 

   MENU TO nMenuItem 

   DO CASE 
   CASE nMenuItem == 0 
      ? "Terminated without selection" 
   CASE nMenuItem == 1 
      ? "Select DBF file" 
   CASE nMenuItem == 2 
      ? "Select index file" 
   CASE nMenuItem == 3 
      ? "Find record" 
   ENDCASE 
RETURN 

FUNCTION TextShow( cText ) 
   LOCAL cColor := SetColor("N/W") 

   MemoEdit( cText, 1, 66, 5, 79, .F., .F. ) 

   SetColor( cColor ) 
RETURN "" 

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.