[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
@...PROMPT
Paint a menu item and define a message.
------------------------------------------------------------------------------
Syntax:
@ <nRow>, <nCol> PROMPT <cMenuItem>
[MESSAGE <cItemMessage>]
[WHEN <lWhenExpression>]
[ACTION <lActionExpression> | PULLDOWN <aPullDown>]
Arguments:
<nRow> and <nCol> are the row and column coordinates of the
menu item display. Row values can range from zero to MAXROW(), and
column values can range from zero to MAXCOL().
<cMenuItem> is the menu item string to display. Imbedding a tilde "~"
in the string forces the following character to be highlighted and its
corresponding ALT key will be used as a hot key into the that choice.
<cItemMessage> defines the message to display each time the current
menu item is highlighted.
<lWhenExpression> is an optional logical expression which is evaluated
to determine if access is available to that menu choice.
<lWhenExpression> is re-evaluated after any menu choice has beeen
acted upon.
<lActionExpression> is an optional logical expression representing the
action to be taken if the menu choice is chosen.
<aPullDown> is an optional array containing pulldown menu arrays.
Description:
@...PROMPT is the display portion of the Clipper light-bar menu
system. Each @...PROMPT command paints a menu item in the current
standard color and defines an associated MESSAGE to be displayed on the
line specified by SET MESSAGE. The light-bar menu is then invoked with
MENU TO. Menu items can be specified in any order and configuration of
row and column position. MENU TO, however, navigates the current list
of menu items in the order they were defined. Up to 4096 menu items can
be defined for each menu.
After each @...PROMPT command, the cursor is located one column
position to the right of the last menu item character and ROW() and
COL() updated to reflect the new cursor position. This allows you to
use ROW() and COL() to specify consecutive menu item positions relative
to the first one painted. See the example below.
When ACTIONs are present the action is performed when the prompt is
chosen and the return value of <lActionExpression> is used to dermine
if the MENU TO is to continue or exit.
When PULLDOWNs are present a pulldown menu is displayed and run. The
pulldown array consists of a series of arrays each detailing a menu
choice to be displayed. If a detail array is empty a break line is
displayed in its place. The detail array for a menu item contains 4
entries: 1 - Character expression representing the item prompt.
An embedded tilde (~) will cause the next character to be
highlighted with its value used as a hot key.
2 - Optional character expression representing the message
associated with the menu item.
3 - Optional codeblock representing the associated action.
It must return a logical indicating whether the menu
is to continue (TRUE) or exit (FALSE).
OR
An optional array representing a PULLOUT menu.
4 - Optional codeblock representing the associated WHEN
clause for the pulldown. Defaults to TRUE.
PULLOUT arrays contain four elements for each menu choice to be
displayed: 1 - Character expression representing the item prompt.
An embedded tilde (~) will cause the next character to be
highlighted with its value used as a hot key.
2 - Optional character expression representing the message
associated with the menu item.
3 - Optional codeblock representing the associated action.
It must return a logical indicating whether the menu
is to continue (TRUE) or exit (FALSE).
4 - Optional codeblock representing the associated WHEN
clause for the pulldown. Defaults to TRUE.
Examples:
This example displays a light-bar menu on line one of the screen with
associated messages displayed on the next line. When the user presses
Return, the position of the item in the list of menu items is assigned
to nChoice:
LOCAL nChoice := 1
SET WRAP ON
SET MESSAGE TO 2
@ 1, 3 PROMPT "File" MESSAGE "Access data files"
@ ROW(), COL() + 2 PROMPT "Edit" MESSAGE "Edit current record"
MENU TO nChoice
This examples displays a few prompts and demonstrates the use of the
SAVE option on the MENU TO action.
#INCLUDE "CUACLIP.CH"
FUNCTION Main()
LOCAL PromptList:={}
LOCAL answer:=2
SET MESSAGE TO MAXROW() CENTER
SET SCOREBOARD OFF
SETCOLOR("W+/B,B/W,,,W/B")
SetMenuColor("W/B,B/W,N+/B,W+/B")
SetMessColor("W/B")
SETCURSOR(0)
CLS
ALTD(0) //Turn off system level scan and consumption of ALT-D
@ 0,1 PROMPT "~Add" MESSAGE "Add a record..." ;
WHEN !NextOne() ;
ACTION Demo( TRUE )
@ 0,COL() + 2 PROMPT "~Edit" ;
MESSAGE "Edit a record..." ;
ACTION Demo()
@ 0,COL() + 2 PROMPT "~Delete" ;
MESSAGE "Delete a record..." ;
WHEN NextOne()
@ 0,COL() + 2 PROMPT "~Next" ;
MESSAGE "Next..." ;
ACTION NextOne(!NextOne())
@ 0,COL() + 2 PROMPT "~TBrowse" ;
MESSAGE "Try the TBrowse demo..." ;
ACTION TBDemo()
@ 0,COL() + 2 PROMPT "E~xit" ;
MESSAGE "Quit and go back to DOS..."
WHILE answer <> 6 .AND. answer <> 0
MENU TO answer SAVE
@ 20,0 SAY answer
END
SETCURSOR(1)
RETURN NIL
STATIC FUNCTION NextOne( newvar )
STATIC var := TRUE
LOCAL oldVar := var
IF PCOUNT() == 1
var := newvar
ENDIF
RETURN oldVar
Files: Library is CUACLIP.LIB and the header file is CUACLIP.CH.
See Also:
MENU TO
SetMenuColor()
SetPullColor()
MAINMENU.PRG
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson