Command @...PROMPT Foundation
Displays a menu item and an optional descriptive message.
@ <nRow>, <nCol> PROMPT <cMenuItem> ;
[MESSAGE <bcMessage>]
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.
// 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
// 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 ""
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.