Re: More adventures with subclassing



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]