Re: Gkt2::CellRendererScalar ??



Quoting muppet <scott asofyet org>:

how useful do you think it would be to have a CellRenderer that draws
perl
scalars?

  $model = Gtk2::ListStore->new ('Glib::Scalar');
  $treeview = Gtk2::TreeView->new ($model);
  $renderer = Gtk2::CellRendererScalar->new;
  $column = Gtk2::TreeViewColumn->new_with_attributes ('a perl var',
                                            $renderer, source => 0);

would basically do the optimized version of

  $model = Gtk2::ListStore->new ('Glib::Scalar');
  $treeview = Gtk2::TreeView->new ($model);
  $renderer = Gtk2::CellRendererText->new;
  $treeview->insert_column_with_data_func (-1, 'a perl var',
$renderer,
                             sub { $_[2]->get ($_[3], 0) });


overkill?  unnecessary?  fancy?  can't live without it?  what do you
think?

-- 
muppet <scott at asofyet dot org>

Does changing the scalar change the text in the cell?  If so, then I think it
falls into "can't live without it".  If not, then I think it falls into "fancy,
but unnecessary".



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