Re: SimpleList cellrenderer/signals



On Sun, 2004-07-11 at 13:10, Jens Wilke wrote:
Hi,

i'd like to connect an signal to a CellRendererToggle in simplelist.
Any ideas welcome.

The method get_renderer as proposed here 
http://mail.gnome.org/archives/gtk-perl-list/2003-July/msg00214.html
is not implemented. That's pity, because it seems not possible to define 
an own cellrenderer for SimpleList.
The following code results "Can't locate object method "new" via package 
"Gtk2::CellRendererToggle=HASH(0x862bb5c)" (perhaps you forgot to load 
"Gtk2::CellRendererToggle=HASH(0x862bb5c)"?) 
at /usr/local/lib/perl/5.8.3/Gtk2/SimpleList.pm line 105."

   my $renderer = Gtk2::CellRendererToggle->new;
   Gtk2::SimpleList->add_column_type( 'del', 
          type     => 'Glib::Boolean',
        renderer => "$renderer",

you're stringifying a renderer object and putting that into the renderer
hash key. what you likely need to do there is 
        renderer => 'Gtk2::CellRendererToggle',
see examples/simplelist.pl in the Gtk2 source. you shouldn't be creating
a renderer to pass into add column. you should be telling it what kind
of renderer to use when it gets that type of column. perhaps it should
be renderer_type, but the documentation does explain that it is a type
string, not an actual renderer.

+++
Some smaller hints for the docu:

the method get_column is not described in the perldoc 2004-04-12.

there isn't a method Gtk2::SimpleList::get_column. that method is on the
parent class Gtk2::TreeView and is doced as it should be on it's page.

"Add a new column type to the list of possible types. Initially six 
column types are defined, text, int, double, bool, scalar, and pixbuf"
'bool' is unknown, seems to be 'boolean'.

from SimpleList.pm list of column types:
        'bool'   => {type=>'Glib::Boolean', 
the column type in there appears to be 'bool' not boolean.  in fact the
default 'bool' column type uses
        renderer =>  Gtk2::CellRendererToggle
as i suggested above.

--
-rm




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