Re: gui problems
| From: | Xavier Garreau | Date: | Thu, 23 Sep 2004 14:58:31 +0000 |
| Subject: | Re: gui problems | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-5110@lists.php.net to get a copy of this message | ||
Try this:
<?php
//load gtk extension--works
$extension = "php_gtk" . (strpos(PHP_OS, "WIN") >= 0 ? ".dll" : ".so");
dl($extension);
$window= & new GtkWindow();
$window->connect('destroy', create_function('','Gtk::main_quit();'));
$window->set_border_width(5);
$window->set_title("Ben's Amazing PHP-GTK Dice Roller");
$window->set_usize((gdk::screen_width()/2), (gdk::screen_height()/2));
//this method, along with other commented sections, wasn't working
$main= &new GtkVBox();
$d4=&new GtkHBox();
$nd4=&new GtkEntry();
$d4->pack_start($nd4);
$bd4=&new GtkButton("Roll 'em");
$bd4->connect("clicked", roll_d4, $nd4);
$d4->pack_start($bd4);
$d6=&new GtkHBox();
$nd6=&new GtkEntry();
$d6->pack_start($nd6);
$bd6=&new GtkButton("Roll 'em");
$bd6->connect("clicked", roll_d6, $nd6);
$d6->pack_start($bd6);
//show main and all children--not working this way--also tried $main->add($d4);
$main->add($d6);
$main->add($d4);
$main->show_all();
$window->add($main);
$window->show_all();
gtk::main();
function buttonClicked($number, $sides){
//$txt=strrev($widget->get_text());
$txt=$number;
$widget->set_text($txt);
}
?>
//end code
--
Xavier Garreau <xavier@xgarreau.org>
http://www.xgarreau.org/