Re: Re[PHP-GTK] defining base class functions?

From: Date: Fri, 20 Jun 2008 12:35:03 +0000
Subject: Re: Re[PHP-GTK] defining base class functions?
References: 1 2  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-8280@lists.php.net to get a copy of this message
kksou wrote: > > Benjamin Smith wrote: >> Is there a way (PHP-GTK1) to redefine a base class method? Specifically, I >> need to change set_usize() so that the values for X and Y can be >> recalculated. >> > > Hi Ben, > > Don't think PHP-GTK1 or PHP-GTK2 allows you to redefine a base class or > override an existing class method. > That's not exactly true - in PHP-GTK2 you can extend a class and then override a call in that class with your own version. For example, you could extend GtkWindow and create a method class MyWindow extends GtkWindow { public method size($x, $y) { // do something to $x $x = $x + 5; // do something to $y if ($y > 10) { $y = 5; } // then call the "real" method return parent::move($x, $y); } } To use this you'd create a window using $window = new MyWindow(); not $window = new GtkWindow(); I have no idea if this works in GTK1... I'd have to wonder why you're using it at all. Thanks, Elizabeth

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