Php5 and php-gtk weirdness
| From: | Elizabeth Smith | Date: | Fri, 12 Sep 2003 13:25:30 +0000 |
| Subject: | Php5 and php-gtk weirdness | ||
| Groups: | php.gtk.general | ||
| Request: | Send a blank email to php-gtk-general+get-3884@lists.php.net to get a copy of this message | ||
I've run into an unusual problem when using php-gtk with php5 (the builds
from http://kromann.info - which are awesome, btw)
The code I'm using is very simple - it's just supposed to show a window
<?php
dl('php_gtk.dll');
include ('lib/window.php');
$class = new Window();
$window = $class->newWindow('main', 'Product :: Title Here');
$window->connect('destroy', 'destroy');
$window->connect('delete-event', 'delete');
$window->show_all();
Gtk::main();
function delete()
{
return FALSE;
}
function destroy()
{
GTK::main_quit();
}
?>
The class is below - very basic. Here's the deal - when I set window to
$this->window inside the newWindow method nothing happens, no window
appears, no errors, no nothing(anything, you get the point). The script
runs, I guess, and that's the end of it.
When I change all instances of $this->window to just $window (of course,
then I'm not storing it in the object, which is the point) it works just jim
dandy.... Can't you store php-gtk widgets inside object variables? or is
something really wrong somewhere?
<?
class Window
{
var $window;
function newWindow($name, $title, $type = GTK_WINDOW_TOPLEVEL, $width =
NULL, $height = NULL, $position = GTK_WIN_POS_CENTER)
{
//find height and width
if(is_null($width))
{
$width = gdk::screen_width()-50;
}
if(is_null($height))
{
$height = gdk::screen_height()-100;
}
//create the window
$this->window = new GtkWindow($type);
$this->window->set_name($name);
$this->window->set_title($title);
$this->window->set_default_size($width, $height);
$this->window->set_position($position);
return $this->window;
}
}
?>
BTW I'm using php5 because I need sqlite and the compiled versions of
php-gtk for php4 don't match the current php4 sqlite .dll that I can find
anywhere so I get a weird error about not being able to find _malloc
something in the php4ts.dll
I have a headache.