1al_show_native_message_box(3) al_show_native_message_box(3)
2
3
4
6 al_show_native_message_box - Allegro 5 API
7
9 #include <allegro5/allegro_native_dialog.h>
10
11 int al_show_native_message_box(ALLEGRO_DISPLAY *display,
12 char const *title, char const *heading, char const *text,
13 char const *buttons, int flags)
14
16 Show a native GUI message box. This can be used for example to display
17 an error message if creation of an initial display fails. The display
18 may be NULL, otherwise the given display is treated as the parent if
19 possible.
20
21 The message box will have a single “OK” button and use the style infor‐
22 mative dialog boxes usually have on the native system. If the buttons
23 parameter is not NULL, you can instead specify the button text in a
24 string, with buttons separated by a vertical bar (|).
25
26 Note: buttons parameter is currently unimplemented on Windows.
27
28 The flags available are:
29
30 ALLEGRO_MESSAGEBOX_WARN
31 The message is a warning. This may cause a different icon (or
32 other effects).
33
34 ALLEGRO_MESSAGEBOX_ERROR
35 The message is an error.
36
37 ALLEGRO_MESSAGEBOX_QUESTION
38 The message is a question.
39
40 ALLEGRO_MESSAGEBOX_OK_CANCEL
41 Display a cancel button alongside the “OK” button. Ignored if
42 buttons is not NULL.
43
44 ALLEGRO_MESSAGEBOX_YES_NO
45 Display Yes/No buttons instead of the “OK” button. Ignored if
46 buttons is not NULL.
47
48 al_show_native_message_box(3) may be called without Allegro being in‐
49 stalled. This is useful to report an error during initialisation of
50 Allegro itself.
51
52 Returns:
53
54 • 0 if the dialog window was closed without activating a button.
55
56 • 1 if the OK or Yes button was pressed.
57
58 • 2 if the Cancel or No button was pressed.
59
60 If buttons is not NULL, the number of the pressed button is returned,
61 starting with 1.
62
63 All of the remaining parameters must not be NULL.
64
65 If a message box could not be created then this returns 0, as if the
66 window was dismissed without activating a button.
67
68 Example:
69
70 int button = al_show_native_message_box(
71 display,
72 "Warning",
73 "Are you sure?",
74 "If you click yes then you are confirming that \"Yes\" "
75 "is your response to the query which you have "
76 "generated by the action you took to open this "
77 "message box.",
78 NULL,
79 ALLEGRO_MESSAGEBOX_YES_NO
80 );
81
82
83
84Allegro reference manual al_show_native_message_box(3)