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
--
PHP-GTK General Mailing List (
http://gtk.php.net/)
To unsubscribe, visit:
http://www.php.net/unsub.php