Re: How to Add a Label??

From: Date: Fri, 19 Jul 2002 11:17:07 +0000
Subject: Re: How to Add a Label??
Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-2269@lists.php.net to get a copy of this message
You are gonna kick yourself :) - easily done though which is why I have several sore bits $button1->connect_object("clicked","show_label",$window,$vbox); i.e. $hbox1 does not exist , $vbox does, you can also lose the call to $window->show_all(); in your function Regards, Simon Wheeler. firepages. ----- Original Message ----- From: "Mark Lopus" <mtl@taladthai.com> To: <php-gtk-general@lists.php.net> Sent: Friday, July 19, 2002 2:15 PM Subject: [PHP-GTK] How to Add a Label?? > 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 (#2269) next »