How to Add a Label??

From: Date: Fri, 19 Jul 2002 06:15:18 +0000
Subject: How to Add a Label??
Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-2268@lists.php.net to get a copy of this message
Hi, I'm still grappling with some conceptual issues...if you have any advise, pls. advise. In the following, I want to add a label to the window whent he button is clicked, but When we click the button, the application quits! Why is this and what's the right way to do it? Thx in advance! <?php dl('php_gtk.' . (strstr(PHP_OS, 'WIN') ? 'dll' : 'so')); function show_label($window,$box) { $label = &new GtkLabel("I'm the label text"); $box->add($label); $box->show_all(); $window->show_all(); } $window = &new GtkWindow(GTK_WINDOW_DIALOG); $window->set_default_size(400,300); $window->connect_object('destroy', array('gtk', 'main_quit')); $window->realize(); $vbox = &new GtkVBox(); $window->add($vbox); $hbuttonbox = &new GtkHButtonBox(); $vbox->pack_start($hbuttonbox); $button1 = &new GtkButton("Add Label"); $hbuttonbox->pack_start($button1); $button1->connect_object("clicked","show_label",$window,$hbox1); $hbox1 = &new GtkHBox(); $vbox->add($hbox1); $window->show_all(); gtk::main(); ?>

« previous php.gtk.general (#2268) next »