#25516 [Sus->Csd]: Gtk Widgets cannot be stored in Object Variables
| From: | auroraeosrose at hotmail dot com | Date: | Thu, 13 Jul 2006 16:36:47 +0000 |
| Subject: | #25516 [Sus->Csd]: Gtk Widgets cannot be stored in Object Variables | ||
| References: | 1 | Groups: | php.gtk.dev |
| Request: | Send a blank email to php-gtk-dev+get-3288@lists.php.net to get a copy of this message | ||
ID: 25516
User updated by: auroraeosrose at hotmail dot com
Reported By: auroraeosrose at hotmail dot com
-Status: Suspended
+Status: Closed
Bug Type: PHP-GTK related
Operating System: Win XP Pro SP1
PHP Version: 1.0.0
New Comment:
Fixed in current CVS
Previous Comments:
------------------------------------------------------------------------
[2003-10-03 21:38:01] alan_k@php.net
I think without a final 'release' version or some ability to debug on
XP it will be imposible to diagnose or fix this.
Suspending until PHP5 & PHP-GTK are actually released.
You may just try removing all the PHP & PHP-GTK binaries and update
from the latest snapshots.
------------------------------------------------------------------------
[2003-09-15 07:31:24] auroraeosrose at hotmail dot com
Although I can't find the directive in the php.ini I'm using, implicit
clone is off if you check phpinfo(); But that would only matter if I
were trying to copy an object, e.g. $window = new GtkWindow();
$newwindow = $window; ...but I'm not doing any of that, I'm just trying
to assign a gtk widget to an object variable
Aliasing does absolutely nothing - problem still exists
------------------------------------------------------------------------
[2003-09-12 23:33:23] alan_k@php.net
can you follow php4 conventsions and use aliasing?
$class = &new Window();
$this->window = &new GtkWindow($type);
does it work ok then?
There is a BC flag in php.ini that is supposed to turn off/on object
cloning.. - is that set?
------------------------------------------------------------------------
[2003-09-12 10:14:37] auroraeosrose at hotmail dot com
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 this bug report at http://bugs.php.net/?id=25516&edit=1