CellRenderCombo in SimpleList example and question re: go to position
- From: Mike Martin <redtux1 gmail com>
- To: gtk-perl-list <gtk-perl-list gnome org>
- Subject: CellRenderCombo in SimpleList example and question re: go to position
- Date: Fri, 8 Oct 2010 16:05:19 +0100
Hi
I am working on getting CellRendererCombo working as I want
Code
##Setup combo column type##
Gtk2::SimpleList->add_column_type(
'combo',type=>'Glib::Scalar',renderer=>'Gtk2::CellRendererCombo',attr=>
sub{
$_[1]->set("text",$_[2]->get($_[3],$_[4]));
$_[1]->set("has_entry","TRUE");
$_[1]->set("editable","TRUE");
$_[1]->set (text_column => 1);
}
##set model##
my $title_rend=$videos_table->get_column(3)->get_cell_renderers;
$title_rend->set(model=>$title_list);
##setup row references##
$videos_table->signal_connect (cursor_changed => sub{
($cell, $path_str) = @_;
($path,$focus)= $videos_table->get_cursor or die print $!;
$row_ref = $videos_table->get_row_data_from_path ($path);
}
);
##changed signal for renderer##
$title_rend->signal_connect('changed'=>sub{
my $rend_iter=$_[2];
$title_id=$title_rend->get("model")->get_value($rend_iter,0);
$title_val=$title_rend->get("model")->get_value($rend_iter,1);
$row_ref->[2]=$title_id; ##$row_ref is set by a get_cursor call on simplelist
$row_ref->[3]=$title_val;
}
);
My only question now is whether it is possible to set the position of
the combobox to that of the current value
eg:
values of combobox render is
1,val1
2,val2
3,val3
4,val4
current value is val3
so that when renderer is clicked val3 is selected in the popup
thanks in advance
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]