Re: Simplelist and remove functions
- From: "Mike Martin" <redtux1 googlemail com>
- To: gtk-perl-list gnome org
- Subject: Re: Simplelist and remove functions
- Date: Wed, 31 Jan 2007 17:02:31 +0000
On 31/01/07, Mike Martin <redtux1 googlemail com> wrote:
I have a Gtk2::Simplelist setup which is working fine except I cant
delete any rows
ie: this works
$add_encode_type_btn->signal_connect('clicked',sub{push
(@{$mod_model->{data}},[undef,undef,undef,undef,undef])});
which adds a record
but this doesnt
$delete_encode_type_btn->signal_connect('clicked',sub{my
@list=$mod_model->get_selected_indices;shift
@{$mod_model->{data}};foreach my $key (@{$mod_model->{data}}){print
"\n",@{$key},"\n"}});
The entry dissapears and the array prints as I would expect. But the
new array doesnt get passed to this function, while the changed array
does in the first case
$amend_encode_type_btn->signal_connect('clicked',sub{%options=&update_opts(@{$mod_model->{data}});&opts($video_type);$mod_win->destroy
});
called subs are
sub update_opts {
my $update=\ _;
my @update;
no strict 'refs';
foreach my $upd (@{$update}){
my @upd;
foreach my $updhash (@{$upd}){
$updhash=~s/\n//g;
push (@upd,$updhash,"\t");
}
$upd=\ upd;
push(@update,$upd);
}
no strict 'refs';
foreach my $upd (@update){
$options{ {$upd}[0]}=[@{$upd}[2..8]] ;
}
&save_options;
return %options;
}
sub opts {
my ($video_type,$enc)= _;
if (defined($video_type)){
my $model= $video_type->get_model ;
$model->clear ;
my $title='Select Encoding Type';
$video_type->append_text("$title");
foreach my $type (sort keys %options){
no strict 'refs';
if ($type ne 'dir' and $type ne 'feedback'){
$video_type->append_text($options{$type}[6]);
}
}
$video_type->set_active(0);
}
}
Forget this - I was being dense - I wasn't updating the hash with a delete.
[
Date Prev][Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]