GtkMessageDialog Constructor

GtkMessageDialog ( GtkWindow parent , GtkDialogFlags flags , GtkMessageType type , GtkButtonsType buttons , string message);

Creates a new message dialog with icon, text and buttons.

Example 103. A modal GtkMessageDialog

<?php
$dialog = new GtkMessageDialog(
    null,//parent
    0,
    Gtk::MESSAGE_QUESTION,
    Gtk::BUTTONS_YES_NO,
    'Do you like PHP-Gtk2?'
);
$dialog->set_markup(
    'Do <b>you</b> like PHP-Gtk '
    . '<span foreground="red">2</span>?'
);
$answer = $dialog->run();
$dialog->destroy();

if ($answer == Gtk::RESPONSE_YES) {
    echo "You like me! Thanks!\r\n";
} else if ($answer == Gtk::RESPONSE_NO) {
    echo "Why not?\r\n";
} else {
    echo "Why didn't you press a button?\r\n";
}
?>

The second parameter could be set to 0, as the run() method automatically makes the dialog modal.