Re: Frame + Button
| From: | Ivan Rodriguez | Date: | Wed, 01 Oct 2003 12:54:45 +0000 |
| Subject: | Re: Frame + Button | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-3935@lists.php.net to get a copy of this message | ||
try this for example:
$window= &new GtkWindow();
$windows['serverWindow'] = &$window;
$window->set_name('checkServer');
$window->connect('delete_event', 'delete_event');
$window->set_policy(false, true, false);
$window->set_title('Query Result');
$window->set_usize(300, 70);
$window->set_uposition(220,85);
$frame= &new GtkFrame('Database Server Connection');
$box= &new GtkVBox();
$label=new GtkLabel();
$label->set_text('Connection status: not connected');
$button= &new GtkButton('OK');
$button->connect('clicked', 'close_window');
$box->pack_start($label, FALSE, FALSE);
$box->pack_end($button, TRUE, TRUE);
$frame->add($box);
$window->add($frame);
$window->show_all();
gtk::main();
----- Original Message -----
From: "Cosmin" <cosminb@as.ro>
To: "PHP-GTK" <php-gtk-general@lists.php.net>
Sent: Wednesday, October 01, 2003 1:24 PM
Subject: [PHP-GTK] Frame + Button
> I'm new with php-gtk so please don't laugh if you fnd this silly
> I'm trying to do something like the alert() function from JavaScript( I
> want a popup window with sometext in it and button that closes the
> window). My problem is that when I add the button I get the following
> error:
> "Gtk-CRITICAL **: file gtkbin.c: line 217 (gtk_bin_add): assertion
> `bin->child == NULL' failed."
>
> Here is my code:
> $window= &new GtkWindow();
> $windows['serverWindow'] = &$window;
> $window->set_name('checkServer');
> $window->connect('delete_event', 'delete_event');
> $window->set_policy(false, true, false);
> $window->set_title('Query Result');
> $window->set_usize(300, 70);
> $window->set_uposition(220,85);
>
> $box= &new GtkVBox();
> $window->add($box);
>
> $frame= &new GtkFrame('Database Server Connection');
> $box->pack_start($frame, true, true, 1);
> $label=new GtkLabel();
> if ($db->checkConnection())
> {
> $label->set_text("Connection status: connected \n Conection
> time:".$db->getTime(2).' seconds');
> }
> else
> $label->set_text('Connection status: not connected');
>
> $frame->add($label);
>
> $button= &new GtkButton('OK');
> $button->connect('clicked', 'close_window');
> $frame->add($button);
>
> $window->show_all();
>
> If anyone knows what I'm doing wrong please tell how to make it work.
>
>
>
> --
> PHP-GTK General Mailing List (http://gtk.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>