Toggled and row-changed signals issue

Hi I have a liststore setup with text,combo and bool columns
I then connect to row-changed signal passing the column number obtained from ‘editing-started’ signal for all columns bar the bool columns, which works fine.
However this doesn’t work for the bool column. So I tried using the ‘toggled’ signal to set this.
The problem is that if I click the toggle before any other cell, the first time it toggles, it runs after row-changed signal, which of course means that there is no column id.

which gives the error here

1381 # should give col no
*** unhandled exception in callback:
***   undefined value for mandatory argument 'n' encountered at /usr/bin/use_videotagspg line 1414.
***  ignoring at /usr/share/perl5/vendor_perl/Gtk3.pm line 2342.
551 # line number of toggled function to check

Any ideas appreciated.

code

foreach my $col (0,1,2,4){
		my $cell=($dirset{dir_view}->get_column($col)->get_cells)[0];
		print $col,"\t",$cell,"\n";
	if ($cell!~/Toggle/){
	$cell->signal_connect('editing-started'=>sub{
		$sopts->{col}=$col;
		print '1351 ',@_,"\n";
		#my ($combo,$row,$iter)=@_;
		#print $dirset{dir_model}->get($dirset{dir_model}->get_iter_from_string($row),$col),"\n";

	}
	);
	}
	elsif ($cell=~/Toggle/) {
		$cell->signal_connect('toggled'=>sub{
		$sopts->{col}=$col;
		print '1371 ',$sopts->{col},"\n";# this print after error
	}
	);
	}
	}

$dirset{dir_model}->signal_connect('row-changed'=>sub{
		my ($model,$row,$iter)= @_;

		if ($sopts->{col} eq ''){
		#	$sopts->{col} =4; 
# a very bad kludge which works here, but obviously wont be satisfactory with more than one bool column
		}
		print '1381 ',$sopts->{col},"\n";
}
);

toggled function is

sub toggled {
	my ($cell, $path_str, $ls) = @_;
	my ($model,$id)=@{$ls};
	my $path = Gtk3::TreePath->new_from_string ($path_str);
	my $iter = $model->get_iter ($path);
	my ($fixed) = $model->get ($iter, $id);
	$fixed =!$fixed;
	$model->set ($iter, $id, $fixed);
	print 551,"\n"; # for testing
	return 1
}

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.