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 The flags available are:
27
28 ALLEGRO_MESSAGEBOX_WARN
29 The message is a warning. This may cause a different icon (or
30 other effects).
31
32 ALLEGRO_MESSAGEBOX_ERROR
33 The message is an error.
34
35 ALLEGRO_MESSAGEBOX_QUESTION
36 The message is a question.
37
38 ALLEGRO_MESSAGEBOX_OK_CANCEL
39 Display a cancel button alongside the "OK" button. Ignored if
40 buttons is not NULL.
41
42 ALLEGRO_MESSAGEBOX_YES_NO
43 Display Yes/No buttons instead of the "OK" button. Ignored if
44 buttons is not NULL.
45
46 al_show_native_message_box(3) may be called without Allegro being
47 installed. This is useful to report an error during initialisation of
48 Allegro itself.
49
50 Returns:
51
52 · 0 if the dialog window was closed without activating a button.
53
54 · 1 if the OK or Yes button was pressed.
55
56 · 2 if the Cancel or No button was pressed.
57
58 If buttons is not NULL, the number of the pressed button is returned,
59 starting with 1.
60
61 All of the remaining parameters must not be NULL.
62
63 If a message box could not be created then this returns 0, as if the
64 window was dismissed without activating a button.
65
66 Example:
67
68 int button = al_show_native_message_box(
69 display,
70 "Warning",
71 "Are you sure?",
72 "If you click yes then you are confirming that \"Yes\" "
73 "is your response to the query which you have "
74 "generated by the action you took to open this "
75 "message box.",
76 NULL,
77 ALLEGRO_MESSAGEBOX_YES_NO
78 );
79
80
81
82Allegro reference manual al_show_native_message_box(3)