Draws a message box on the screen.
Alert[Box] IconAndFlag, MainText$, DefButton, ButtonText$ [,RetVal]
RetVal = Alert[Box](IconAndFlag, MainText$, DefButton, ButtonText$)
IconAndFlag, DefButton | : iexp |
RetVal | : ivar |
MainText$, ButtonText$ | : sexp |
An Alert box is a special form of a message box. It is used when a point in a program is reached where the program is to be cancelled, a certain branch is to be taken, or some other user decision is to be made.
The first integer expression, IconAndFlag, determines which symbol will be included in the Alert box together with the message. The following symbols are available:
IconAndFlag | Meaning |
---|---|
0 | mark symbol |
1 | stop mark |
2 | question mark |
3 | exclamation mark |
4 | information mark |
5 | windows flag |
6 | application mark |
7 | information mark |
16 | buttons are placed at the right border |
32 | shadow |
64 | text is right aligned |
128 | text is centered |
MainText$ contains the message which is to be displayed in the Alert Box. If the text is too long for one line it can be split in up to 4 lines by using "|".
ButtonText$ contains up to five possible alternatives for user response.
DefButton indicates which of these alternatives the default is. This alternative is then selected by pressing the Return key. The alternatives are numbered from 1 to 5 and are separated from each other by a "|".
RetVal contains the number of the alternative which was actually selected.
To ensure that the Alert box is centred on its owner, use the DlgCenter[Hook] command.
$Library "UpdateRT"
UpdateRuntime // Patches GfaWin23.Ocx - needed to fix White background bug
Local a$, b$, retval%
OpenW 1
a$ = "Which procedure should|be executed next"
b$ = "Input | Calculate | Print | File output | CANCEL"
retval% = 0
Alert 2 | 16, a$, 1, b$, retval%
Print "Return Value:"; retval%
Do : Sleep : Until Win_1 Is Nothing
Creates an Alert Box with a question mark as symbol and the message: "Which procedure should be executed next". The default alternative is "Input". The alternatives are:
Input, Calculate, Print, File output, and CANCEL.
retval% contains the number of the selected alternative. This returns 1 if the first alternative is selected, 2 for the second, and so on; if the Alert Box is terminated irregularly, 0 is returned.
AlertBox is a synonym to Alert and can be used instead.
In addition to the menu bar and pop-up menus, the Alert[Box] is a third possible way of communication between the program and the user. Furthermore, it can prove useful when incorporated inside LG32 libraries as a customised messagebox, where OCX objects and Dialogs can not be used.
DlgCenter, DlgCenterHook, Menu, Message, MsgBox, Popup, Prompt
{Created by Sjouke Hamstra; Last updated: 06/03/2022 by James Gaite}