msgBoxCustom
msgBoxCustom(msg: String; title: String; flags: Integer; btnCaptions: ParamListType): Integer;
The msgBoxCustom method of the Application class displays a message box with customized button captions and waits for the user to click a button. The method displays a message box with as many buttons displayed as there are string captions specified in the btnCaptions parameter.
You can call this method only in a GUI application, because it is implemented in jade.exe.
The method parameters are listed in the following table.
Parameter | Specifies the... |
---|---|
msg | Message displayed in the dialog. |
title | Dialog title (null ("") displays the application name). |
flags | Icons that are to be displayed in the dialog, the cancel button, and the default button. |
btnCaptions | String captions for the buttons to be displayed. The number of captions parameters defines the number of buttons to be displayed (in the range 1 through 5). |
In a custom message box:
-
The application name is shown as the title if the value of the title parameter is null.
-
The required icon, specified in the flags parameter, is verified. If it is not valid, an invalid parameter exception is generated.
-
Very large strings without spaces are handled in the title and the message box text so that the message will not enlarge beyond two‑thirds of the width of the monitor on which it is displayed.
Long titles are truncated. Long message text without spaces is wrapped onto the next line when strings exceed the width of the assigned message area.
The code fragment in the following example shows a msgBoxCustom method call.
retVal := app.msgBoxCustom("Please choose how many of the articles you require", "Selection", MsgBoxCustom_Icon_Question_Mark + MsgBoxCustom_Default_First + MsgBoxCustom_Cancel_Four, "1", "2", "3", "None");
The return value is the number of the button clicked by the user. The default button has been set to the first button and the fourth button is the button that will be clicked when the Esc key is pressed.
The new MessageBoxCustom category provides global constants for this method.
Do not use the global constants in the MessageBox category, because some MessageBoxCustom global constants are synonyms while others do not apply (for example, buttons required).
The flags parameter is constructed by adding a constant from each of the first three groups. Use one constant only from each group. The global constants in the MessageBoxCustom category are listed in the following table.
Global Constant | Integer Value | Description |
---|---|---|
MsgBoxCustom_Cancel_None | 0 | There is no Cancel button (the default), and pressing Esc will be ignored |
MsgBoxCustom_Cancel_One | 1 | First button is the Cancel button |
MsgBoxCustom_Cancel_Two | 2 | Second button is the Cancel button |
MsgBoxCustom_Cancel_Three | 3 | Third button is the Cancel button |
MsgBoxCustom_Cancel_Four | 4 | Fourth button is the Cancel button |
MsgBoxCustom_Cancel_Five | 5 | Fifth button is the Cancel button |
MsgBoxCustom_Default_First | MsgBox_Default_First (0) | First button is the default button (default) |
MsgBoxCustom_Default_Second | MsgBox_Default_Second (256) | Second button is the default |
MsgBoxCustom_Default_Third | MsgBox_Default_Third (512) | Third button is the default |
MsgBoxCustom_Default_Fourth | #300 | Fourth button is the default |
MsgBoxCustom_Default_Fifth | #400 | Fifth button is the default |
MsgBoxCustom_Icon_Exclamation_Mark | MsgBox_Exclamation_Mark_Icon | Displays the exclamation icon |
MsgBoxCustom_Icon_Information | MsgBox_Information_Icon | Displays the information icon |
MsgBoxCustom_Icon_Question_Mark | MsgBox_Question_Mark_Icon | Displays the question mark icon |
MsgBoxCustom_Icon_Stop | MsgBox_Stop_Icon | Displays the stop icon |
MsgBoxCustom_Return_One | 1 | |
MsgBoxCustom_Return_Two | 2 | |
MsgBoxCustom_Return_Three | 3 | |
MsgBoxCustom_Return_Four | 4 | |
MsgBoxCustom_Return_Five | 5 |
If you do not include one of the MsgBoxCustom_Icon_ values, no icon is displayed.
The MsgBoxCustom_Return_ global constants can be used to return and test the value of the clicked button.
If the application is not a GUI application, error 14078 (A gui action has been requested in a non-gui environment) occurs. If the number of button captions is zero (0) or greater than 5, error 1407 (Invalid argument passed to method) occurs. If a caption is not a string or is null (""), error 1000 (Invalid parameter type) occurs.
2020.0.01 and higher