PHP-GTK
Saturday, July 04, 2009 
download | documentation | applications | faq | changelog | resources 


search for in the  


previousGtkDialog
GtkDialog::add_action_widgetnext

Last updated: Sat, 04 Jul 2009
view this page in English | Bulgarian | Japanese | Brazilian | Simplified Chinese

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 49. 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: Sat, 04 Jul 2009
view this page in English | Bulgarian | Japanese | Brazilian | Simplified Chinese


credits 

PHP  Copyright © 2001-2009 The PHP Group
 All rights reserved.
Last updated: Sat Jul 4 01:52:13 2009 UTC