PHP-GTK
Monday, December 22, 2014 
download | documentation | applications | faq | changelog | resources 


search for in the  


previousGtkDialog
GtkDialog::add_action_widgetnext

Last updated: Sun, 12 May 2013
view this page in English

GtkDialog Constructor

GtkDialog ([string title = null [, GtkWidget parent_window = null [, GtkDialogFlags dialog_flags = 0 [, array (GtkButton, GtkResponseType)]]]]);

Use the constructor to generate a dialog box in accordance with the parameters provided. Alternatively, you may not pass any parameters and construct all elements of the dialog manually.

Example 51. An reconstruction of the GtkMessageDialog using GtkDialog.

<?php
/* Creating and initialising the dialog box */
$dialogBox = new GtkDialog(
    "This is a Dialog",
    NULL,
    Gtk::DIALOG_MODAL,
    array(
        Gtk::STOCK_NO, Gtk::RESPONSE_NO,
        Gtk::STOCK_YES, Gtk::RESPONSE_YES
    )
);
 
/* Creating and adding a question to the dialog */
$dialogQues = new GtkLabel("Do you like PHP-Gtk2?");
$topArea = $dialogBox->vbox;
$topArea->add($dialogQues);
 
/* Showing all widgets added */
$dialogBox->show_all();
 
/* Running the dialog box */
$result = $dialogBox->run();
 
/* Accessing the result and performing
   appropriate action */
switch($result) {
    case (Gtk::RESPONSE_YES):
        echo "Thanks!\n";
        break;
    case (Gtk::RESPONSE_NO):
        echo "Why Not?!\n";
        break;
}
 
/* Destroying the dialog box */
$dialogBox->destroy();
?>

User Contributed Notes
gtk.gtkdialog.constructor.php
add a note about notes
There are no user contributed notes for this page.


previousGtkDialog
GtkDialog::add_action_widgetnext

Last updated: Sun, 12 May 2013
view this page in English


credits 

PHP  Copyright © 2001-2014 The PHP Group
 All rights reserved.
Last updated: Sun May 12 20:50:56 2013 CEST