al_show_native_message_box
int al_show_native_message_box(ALLEGRO_DISPLAY *display,
char const *title, char const *heading, char const *text,
char const *buttons, int flags)
Introduced in 5.0.0
Show a native GUI message box. This can be used for example to display an error message if creation of an initial display fails. The display may be NULL, otherwise the given display is treated as the parent if possible.
The message box will have a single "OK" button and use the style informative dialog boxes usually have on the native system. If the buttons
parameter is not NULL, you can instead specify the button text in a string, with buttons separated by a vertical bar (|).
- ALLEGRO_MESSAGEBOX_WARN
- The message is a warning. This may cause a different icon (or other effects).
- ALLEGRO_MESSAGEBOX_ERROR
- The message is an error.
- ALLEGRO_MESSAGEBOX_QUESTION
- The message is a question.
- ALLEGRO_MESSAGEBOX_OK_CANCEL
- Instead of the "OK" button also display a cancel button. Ignored if
buttons
is not NULL. - ALLEGRO_MESSAGEBOX_YES_NO
- Instead of the "OK" button display Yes/No buttons. Ignored if
buttons
is not NULL.
al_show_native_message_box may be called without Allegro being installed. This is useful to report an error to initialise Allegro itself.
Returns:
- 0 if the dialog window was closed without activating a button.
- 1 if the OK or Yes button was pressed.
- 2 if the Cancel or No button was pressed.
If buttons
is not NULL, the number of the pressed button is returned, starting with 1.
If a message box could not be created then this returns 0, as if the window was dismissed without activating a button.
Example:
button = al_show_native_message_box(
display,
"Warning",
"Are you sure?",
"If you click yes then you are confirming that \"Yes\""
"is your response to the query which you have"
"generated by the action you took to open this"
"message box.",
NULL,
ALLEGRO_MESSAGEBOX_YES_NO
);
Examples: ex_native_filechooser, ex_nodisplay
Most helpful discussions:
- Weird Crash (1)
- Compiling from the command line with gcc (1)
- RPG game (Arrays, Structs Message boxes) (1)
- [A5] Possible to make alerts? (1)
- Hidden Message Box (native dialogs) (1)
- Problems loading using PHYSFS (1)
- I am looking for correct detailed instructions how to build Allegro....
- Getting Allegro to Play Nice with Windows Scaling Settings
- Allegro Access Violation while Drawing
- Allegro 5 crashes when using al_draw_bitmap inside a list container
Other recent discussions:
- Allegro 5.2.7 released! (-1)
- MinGW does not see the library
- al_init_primitives_addon is undefined VS2017 Nuget
- Some allegro 5 functions not working on some laptops
- struggling with initialisation using CMake on arch
- open directories with special characters
- Depth bug (Allegro 5 + Opengl)
- Install Allegro 5.2.4.1 on Win10
- al_create_display not working!
- Allegro 5 basic game loop