Re: Re: Gtk::input_add() for a popen() filehandle?
| From: | Alan Knowles | Date: | Tue, 09 Apr 2002 15:51:07 +0000 |
| Subject: | Re: Re: Gtk::input_add() for a popen() filehandle? | ||
| References: | 1 2 3 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-1765@lists.php.net to get a copy of this message | ||
I'm not getting anywhere with this :) - and it's getting late. (this is using php-gtk CVS and php4.2Rc2)
- simple proof of concept: press the button, and the program is supposed to do a fopen or popen, and add a callback.
Am I missing something here....
regards
alan
<?
error_reporting(E_ALL);
dl('php_gtk.'.(strstr(PHP_OS, 'WIN') ? 'dll' : 'so'));
class MyClass {
var $window;
var $pixmap;
var $mask;
var $w;
function build() {
$this->window = &new GtkWindow();
$this->window->set_position(GTK_WIN_POS_CENTER);
$this->window->set_name('my_window');
$this->window->connect_object('destroy', array('gtk', 'main_quit'));
$this->box = &new GtkVbox();
$this->window->add($this->box);
$this->gtktext = &new GtkText();
$this->box->add($this->gtktext);
$this->button = &new GtkButton("press me");
$this->button->connect("pressed",array(&$this,"pressed"));
$this->box->add($this->button);
$this->window->show_all();
}
function pressed() {
echo "starting something";
$fp = fopen("/home/alan/access.log","r");
Gtk::input_add($fp, GDK_INPUT_READ, array(&$this,"reader"));
}
function reader($a,$b,$c) {
echo "got something";
echo serialize(array($a,$b,$c));
}
}
$gui = new MyClass;
$gui->build();
gtk::main();
?>
Andrei Zmievski wrote:
On Thu, 04 Apr 2002, James Cameron wrote:On Wed, Apr 03, 2002 at 01:13:02PM -0600, Andrei Zmievski wrote:You can ask if anyone on the list can build it for you. -Andrei * DOS is, quite possibly, the worst text-adventure game ever. *Okay, the patch I sent out should work for PHP 4.3.0-dev. I tested it. By the way, Cameron, are you calling gtk::main() in your sample script?James. Yep, definitely. Without calling that I didn't think anything would show on screen. Thanks for the patch, I will adopt it for my Linux systems, but for Windows I'll have to wait for a new Win32 binary kit, as I do not have the build tools mentioned in win32/README.win32.txt . I'll probably just ship .BAT files to my customer in the meanwhile, rather than a GUI.