Re: class problem

From: Date: Wed, 26 Dec 2001 16:03:57 +0000
Subject: Re: class problem
References: 1  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-919@lists.php.net to get a copy of this message
Hmm, I've run a test script myself now. <? dl('php_gtk.' . (strstr(PHP_OS, 'WIN') ? 'dll' : 'so')) || die("Can't load php_gtk module!\n"); $window = &new GtkWindow(); $window->connect_object('destroy', array('gtk', 'main_quit')); $test = &new GtkEntry(); $window->add($test); $parent = get_parent_class($test); echo serialize($test)."\n"; echo serialize($parent)."\n"; if(is_subclass_of($test, $parent)) echo "true\n"; else echo "false\n"; $window->show_all(); gtk::main(); ?> result: O:8:"GtkEntry":1:{i:0;i:2;} s:11:"GtkEditable"; false I think this is down to the way the object hierarchy is set up in GTK+. Each object is uniquely typed with reference to its parent class type, which possibly precludes it being identified as a subclass even of that parent. It's not a direct parent-child relationship in the way that it would be if created in PHP. Tell all if I speak rubbish, someone :) ----- Original Message ----- From: <PublicYMasterjy@aol.com> To: <php-gtk-general@lists.php.net> Sent: Wednesday, December 26, 2001 11:11 AM Subject: [PHP-GTK] class problem > I've been stucked here all night, can anyone help me! > I am not able to get serialize, is_subclass_of to work with gtk classes. > for example, after I created a GtkEntry named $test, is_subclass_of($test, > 'GtkWidget') returns false, serialize($test) will only holds information of > class GtkEntry, all parent class information is lost! > > > > > -- > PHP-GTK General Mailing List (http://gtk.php.net/) > To unsubscribe, e-mail: php-gtk-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-gtk-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.gtk.general (#919) next »