[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
ALERT()
Display a simple modal dialog box
------------------------------------------------------------------------------
Syntax
ALERT( <cMessage>, [<aOptions>] ) --> nChoice
Arguments
<cMessage> is the message text displayed and centered in the alert
box. If the message contains one or more semicolons, the text after the
semicolons is centered on succeeding lines in the dialog box.
<aOptions> defines a list of up to 4 possible responses to the
dialog box.
Returns
ALERT() returns a numeric value indicating which option was chosen. If
the Esc key is pressed, the value returned is zero.
Description
The ALERT() function creates a simple modal dialog. It is useful in
error handlers and other "pause" functions. The user can respond by
moving a highlight bar and pressing the Return or SpaceBar keys, or by
pressing the key corresponding to the first letter of the option. If
<aOptions> is not supplied, a single "Ok" option is presented.
ALERT() is sensitive to the presence or absence of the CA-Clipper
full-screen I/O system. If the full-screen system is not present,
ALERT() uses standard I/O to display the message and options tty-style
(i.e., 80-column, without word wrap, each line ended with carriage
return/linefeed).
Examples
. This example demonstrates use of an alert dialog box. First,
the array of options is defined, the ALERT() function gets the user's
selection, and finally, the user's choice is handled with a DO
CASE...ENDCASE control structure:
#define AL_SAVE 1
#define AL_CANCEL 2
#define AL_CONT 3
// Define an array of options
aOptions := {"Save", "Don't Save", "Continue"}
// Display the dialog box and get the user's selection
nChoice := ALERT("File has changed...", aOptions)
// Handle the user's request
DO CASE
CASE nChoice == AL_SAVE
? "Save"
CASE nChoice == AL_CANCEL
? "Don't Save"
CASE nChoice == AL_CONT
? "Continue"
OTHERWISE
? "Escape"
ENDCASE
//
RETURN
Files Library is LLIBG.LIB.
See Also:
@...PROMPT
MENU TO
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson