Re: More adventures with subclassing
- From: Emmanuele Bassi <ebassi gmail com>
- To: Jeffrey Ratcliffe <jeffrey ratcliffe gmail com>
- Cc: "gtk-perl-list gnome org List" <gtk-perl-list gnome org>
- Subject: Re: More adventures with subclassing
- Date: Thu, 26 Jul 2012 09:10:43 +0100
hi;
On 25 July 2012 20:11, Jeffrey Ratcliffe <jeffrey ratcliffe gmail com> wrote:
It seems that in subclassed a widget, any properties assigned in
->new() are not available in INIT_INSTANCE.
yes, it's been like that for ever. INIT_INSTANCE is meant to be used
to initialize the instance; you want a CONSTRUCTED sub, which is
available in C but I never remember if it was added to perl-Glib.
Therefore, if I want to use values passed in ->new() during the
construction of the widget, I must override new().
How?
something along the lines of:
sub new () {
return Glib::Object::new('YourClass', 'property1', $val, 'property2', $val);
}
ciao,
Emmanuele.
--
W: http://www.emmanuelebassi.name
B: http://blogs.gnome.org/ebassi/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]