xHarbour Reference Documentation > Function Reference |
Displays a text-mode dialog box with a message.
Alert( <xMessage>, [<aOptions>], [<cColor>], [<nDelay>] ) --> nChoice
The function returns a numeric value indicating the ordinal position within <aOption> of the prompt selected by the user. When the ESC key is pressed, the user aborted the selection and the return value is 0.
If <nDelay> is specified and this number of seconds has elapsed without a key press, the return value is 1.
Alert() displays a simple text-mode dialog box and lets the user select an option. The user can move a highlight bar using arrow keys or the TAB key. To select an option, the user can press ENTER, SPACE or the first letter of an option.
See also: | @...PROMPT, AChoice(), DispBox(), DispOut(), MENU TO |
Category: | UI functions |
Source: | rtl\alert.prg |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example displays a message to terminate or resume the program. // After 5 seconds without user response, the program quits automatically. PROCEDURE Main() LOCAL cMessage, aOptions, nChoice cMessage := "Quit program?;(auto-quit in 5 seconds)" aOptions := { "Yes", "No" } nChoice := Alert( cMessage, aOptions, , 5) DO CASE CASE nChoice == 0 ? "Program not interrupted ..." CASE nChoice == 1 QUIT CASE nChoice == 2 ? "Program resumed ..." ENDCASE RETURN
http://www.xHarbour.com