Re: Gtk2::CellRendererMultiline is not registered with gperl as anobject

Jens Wilke said:
i copied
package Mup::MultilineEntry;
package Gtk2::CellRendererMultiline;
without any changes from examples/  into my script.

note that the use of the Gtk2:: namespace in the examples is actually a poor
practice on our part and should not be followed.  imagine the nastiness that
would ensue if/when gtk+ creates its own object with the same name and
different semantics upstream.  perhaps we should change those.  ;-)

my $renderer = Gtk2::CellRendererMultiline->new;
in package main causes the following error:

Gtk2::CellRendererMultiline is not registered with gperl as an object
type at /usr/local/bin/gtk-gallery line 193.

How could this error be caused?

this error message comes from Glib::Object::new(); the first thing it does is
try to fetch the GType corresponding with the given package name, and the
error message you posted is what you get when that package is not registered.

basically, this means:

1) you have tried to instantiate an object before the GObject type has been
registered.  check the order of 'require' and 'use' statements.

2) there may be a typo or something that caused the GType to be registered
with the wrong package name.  check the package names.  (when you 'use
Glib::Object::Subclass', the class is registered with __PACKAGE__, so the
current package name is important.)

muppet <scott at asofyet dot org>

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]