On 31/01/07, Mike Martin <[EMAIL PROTECTED]> 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 [EMAIL PROTECTED]; > my @update; > no strict 'refs'; > > foreach my $upd (@{$update}){ > my @upd; > foreach my $updhash (@{$upd}){ > $updhash=~s/\n//g; > push (@upd,$updhash,"\t"); > } > [EMAIL PROTECTED]; > push(@update,$upd); > > } > > no strict 'refs'; > foreach my $upd (@update){ > [EMAIL PROTECTED]@{$upd}[2..8]] ; > } > > &save_options; > > return %options; > } > > sub opts { > my ($video_type,$enc)[EMAIL PROTECTED]; > > 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. _______________________________________________ gtk-perl-list mailing list gtk-perl-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-perl-list