Re: SimpleList cellrenderer/signals

On Jul 11, 2004, at 1:10 PM, Jens Wilke wrote:


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

The method get_renderer as proposed here
is not implemented.

such functionality is already in place with the treeview.

  $column = $treeview->get_column ($column_index);
  @renderers = $column->get_cell_renderers;
  # for SimpleList columns, which have only one renderer, the
  # object of interest is
  $renderer = $renderers[0];

in general treeview usage, however, columns may have any number of renderers packed into them; this is how you get, for example, a pixbuf and text in the same column.

That's pity, because it seems not possible to define an own cellrenderer for SimpleList.

i beg to differ ;-)

The following code results "Can't locate object method "new" via package
"Gtk2::CellRendererToggle=HASH(0x862bb5c)" (perhaps you forgot to load
at /usr/local/lib/perl/5.8.3/Gtk2/ line 105."

you stringified the cellrenderer reference. it wants a package name, not an object instance, so that it can create a new object for each column. to use a custom renderer, you create a new renderer *class*, and pass its name to add_column_type().

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

          renderer => 'MyCustomRenderer', # package/class name

          attr     => 'active'

Some smaller hints for the docu:

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

that's because get_column() is inherited from Gtk2::TreeView, and documented there.

"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'.

really?  that's odd.  at (version 0.15):

'bool' => {type=>'Glib::Boolean', renderer=>'Gtk2::CellRendererToggle', attr=>'active'},

"Ghostbusters" is the best movie of this decade.
  -- Neal, circa 1996, referring to a movie released in 1984.

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