Issue with iters with cellrenderercombo and sorted columns

I have a wierd issue with iters and and a liststore with a combo cellrender and edited signal.
If I dont sort the column everything is fine the iter points to the right row.
However if I do sort the iter points to a different row

Code is

setup for column renderers

sub tv_cols {
    my ($cols,$list,$liststore)=@_;

    foreach my $col (@{$cols}){
        my $column;
        my $r;
        my $id=$col->[0];
        if ($col->[1] eq 'text'){
            $r->set( editable => $col->[3] );

            $column = Gtk3::TreeViewColumn->new_with_attributes(
                $col->[2],$r,'text' => $col->[0]
            my $model1=[$liststore,$id];
            $r->signal_connect (edited => \&cell_edited, $model1);
        elsif ($col->[1] eq 'bool') {
            $column = Gtk3::TreeViewColumn->new_with_attributes(
                $col->[2],$r,'active' => $col->[0]

            my @id=($liststore,$col->[0]);
        elsif ($col->[1] eq 'combo') {

            #$r->set( activatable => 1 );
            my $model=Gtk3::ListStore->new('Glib::String');
            foreach my $list (@{$col->[4]}){
            my $model1=[$liststore,$id];
            $r->signal_connect (edited => \&cell_edited, $model1);
            $column = Gtk3::TreeViewColumn->new_with_attributes(
                $col->[2],$r,'text' => $col->[0]
            my @id=($liststore,$col->[0]);
    return 1

sub cell_edited {
    my ($cell, $path_string, $new_text, $model1) = @_;
    my ($model2,$column)=@{$model1};
    my $model;
    my $path = Gtk3::TreePath->new_from_string ($path_string);
    my $iter = $model2->get_iter ($path);
    my $iter2;
    if ($model2=~/TreeModelFilter/){
    else {
    my $gvalue = Glib::Object::Introspection::GValueWrapper->new (
        'Glib::String', $new_text);
    $model->set_value ($iter2, $column, $gvalue);
    return 1

edited sub-routine

            my ($cell, $path_str, $value) = @_;
           my $iter;
            $iter=$list->get_model->get_iter_from_string($path_str) ;
            my @updfiles;
            my @listcols=$list->get_model->get($iter,0,1,5);
            @updfiles= ($value,$listcols[1],$listcols[2])
@updfiles contains the wrong rowid (column 5 is a rowid from a database)
The sort is just
$list->get_column(0)->set_sort_column_id (0);
nothing fancy
seems to only affect a cellrenderercombo
I have another column wihich is cellrenderertext which has no issues

Any ideas why this is happening



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