#25516 [NEW]: Gtk Widgets cannot be stored in Object Variables
| From: | auroraeosrose at hotmail dot com | Date: | Fri, 12 Sep 2003 14:14:37 +0000 |
| Subject: | #25516 [NEW]: Gtk Widgets cannot be stored in Object Variables | ||
| Groups: | php.gtk.dev | ||
| Request: | Send a blank email to php-gtk-dev+get-524@lists.php.net to get a copy of this message | ||
From: auroraeosrose at hotmail dot com
Operating system: Win XP Pro SP1
PHP version: 5CVS-2003-09-12 (dev)
PHP Bug Type: PHP-GTK related
Bug description: Gtk Widgets cannot be stored in Object Variables
Description:
------------
I went to the mailing list first to make sure I wasn't losing my mind and
they assured me I'm supposed to be able to store a widget in an object
variable. I'm using builds from http://kromann.info for php5
and php-gtk
for php5
The code I'm using is very simple - it's just supposed to show a window.
The class is below - very basic. Here's the deal - when use $this->window
inside the newWindow method nothing happens. The script runs, I guess,
and that's the end of it.
It seems to be impossible to assign a php-gtk widget to an object
variable, which is really, really annoying
Reproduce code:
---------------
<?php
dl('php_gtk.dll');
$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();
}
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;
}
}
?>
Expected result:
----------------
A window should appear
Actual result:
--------------
Nothing happens, no errors, the script just kind of acts like it was run
and closed.
Here's some more weirdness - php seems to be dying completely (and
silently) on
$this->window = new GtkWindow($type);
because I can't echo or print_r or var_dump anything after that call,
while before I can just fine, and I'm not getting any errors.
And if I change every occurence of $this->window to just $window and try
to do a var_dump, nothing is printed but the window appears. If I do a
print_r on $window
I get GtkWindow Object - and the window appears properly - so the problem
is with the object variable.
--
Edit bug report at http://bugs.php.net/?id=25516&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25516&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25516&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=25516&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=25516&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=25516&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=25516&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=25516&r=support
Expected behavior: http://bugs.php.net/fix.php?id=25516&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=25516&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=25516&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=25516&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25516&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=25516&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=25516&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=25516&r=gnused