Adding a customer cell renderer to a simplelist

Hi all.

I'm having my 2nd attempt at custom cell renderers.
I've got the CellRendererSpinButton from the example folder in a package.

So far, I've got:


my $slist = Gtk2::SimpleList->new_from_treeview(
$prospects->get_widget('Locations_SList'), 'DanPK' => 'hidden', 'LocNo' => 'hidden', 'Branch Name' => 'text', 'Address' => 'text', 'Suburb' => 'text', 'State' => 'text'

for (my $counter = 0; $counter < 4; $counter ++) {
   $slist->set_column_editable($counter, 1);

$slist->get_model->signal_connect("row-changed", \&on_Locations_Edited);

my $renderer = Gtk2::CellRendererSpinButton->new();

                   mode    => "editable",
                   min     => 0,
                   max     => 1000,
                   step    => 1,
                   digits  => 0

$renderer->signal_connect(edited => \&locations_postcode_cell_edited);

$column = Gtk2::TreeViewColumn->new_with_attributes(


The column gets added to the simplelist, and the spinbutton renderer appears when I edit the cell, but data that I load into the simplelist doesn't get into the cellrenderer.

I'm pretty sure this is caused by the same problem as I had on my first attempt. Back then I was told:

2) when the column is asked to set the data for the popup render, it fetches the data from the model as a string (char*, known to the glib type system as 'gchararray'), and passes that value to the popup cell renderer, but the type system sees that the cell renderer wants a boxed object of type 'Glib::Scalar', which is registered with the C type system as 'GPerlSV'. there is no way to convert that, so you get this warning:


use a 'scalar' column type when you create the simplelist.

note that in the example's driver code, the list data column is created as 'Glib::Scalar', and i used a custom cell data callback to format the list for display.

Unfortunately I didn't completely understand what this meant at the time, and still don't. What does it mean that I have to use a 'scalar' column type when I create the simplelist? Is this referring to the line:

$column = Gtk2::TreeViewColumn->new_with_attributes(

or am I supposed to create the column *with* the simplelist ( instead of adding it as above ) and change it's renderer?

Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: dkasak nusconsulting com au
Title: CanIt Vote for ID 90286

The following links have been inserted by the NUS Consulting internal spam filter and are for NUS Consulting staff only
Not spam
Forget previous vote

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