Re: Fatal error: Underlying object missing

From: Date: Mon, 17 Nov 2003 12:36:11 +0000
Subject: Re: Fatal error: Underlying object missing
References: 1  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-4164@lists.php.net to get a copy of this message
Why don't you extend the class this way ? class GtkItemEntry extends GtkEntry { function GtkItemEntry() { GtkEntry::GtkEntry(); //calls the superclass constructor; } function my_set_text($x) { GtkEntry::set_text($x) } } ... regards Pablo On 16 Nov 2003 14:53:09 +0100 epplestun <epplestun@alaplaya.com> wrote: > Hi I'm trying to extending a Widget, I'm doing this: > > <?PHP > dl("php_gtk.so"); > > class GtkItemEntry extends GtkEntry { > var $widget = array(); > > function GtkItemEntry() { > $this->widget['GtkItemEntry'] = $this->__main(); > $this->__setText($this->widget['GtkItemEntry']); > } > > function __main() { > return new GtkEntry(); > } > > function __setText($widget) { > $widget->set_text("HI"); > } > } > > $v = new GtkWindow(); > $v->connect_object('destroy', array('gtk', 'main_quit')); > > $e = new GtkItemEntry(); > > var_dump($e); > > $v->add($e); > $v->show_all(); > gtk::main(); > ?> > > > But in the line 28 the PHP interpreter say this: > > Fatal error: Underlying object missing in > /home/epplestun/Proyectos/GtkItemEntry/class.gtkitementry.php on line 28 > > The line 28 is: $v->add($e); > > why this error?¿ > > And other question, if I do this: > > <?PHP > dl("php_gtk.so"); > > class GtkItemEntry extends GtkEntry { > var $widget = array(); > > function GtkItemEntry() { > $this->widget['GtkItemEntry'] = $this->__main(); > $this->__setText(); > } > > function __main() { > return new GtkEntry(); > } > > function __setText() { > $this->widget['GtkItemEntry']->set_text("HI"); > } > } > > $v = new GtkWindow(); > $v->connect_object('destroy', array('gtk', 'main_quit')); > > $e = new GtkItemEntry(); > > var_dump($e); > > $v->add($e); > $v->show_all(); > gtk::main(); > ?> > > PHP interpreter say: > > Fatal error: Class 'gtkitementry' does not support overloaded method > calls in > /home/epplestun/Proyectos/GtkItemEntry/class.gtkitementry.php on line 17 > > The line 17 is: $this->widget['GtkItemEntry']->set_text("HI"); > > Why this?¿ > > Regards > > -- > PHP-GTK General Mailing List (http://gtk.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -------------------------------------------------------------------- 2º Seminário de Desenvolvimento em Software Livre Unicamp - Campinas - São Paulo 9 a 12 de dezembro Informações e Inscrições: http://rau-tu.ccuec.unicamp.br/sdsl -------------------------------------------------------------------- :: Pablo Dall'Oglio (pablo@php.net) +55 (51) 3714-7040 :: Solis - Cooperativa de Solucoes Livres :: www.solis.coop.br - Lajeado, RS - Brasil :: www.varianet.com.br (personal) :: "Life's a Journey, Not a Destination" - Steven Tyler

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