Combox - show one column but two columns in popup
- From: Mike Martin <mike redtux org uk>
- To: gtk-perl-list gnome org
- Subject: Combox - show one column but two columns in popup
- Date: Tue, 20 Jun 2017 00:59:51 +0100
Is this possible?
ie I have a combobox based on a two column liststore
I want only the first column to be shown in the combobox, but both columns to be shown in the popup
The model is populated by an array of filename/directory name
I'm sure I must be missing something obvious
thanks
example
my $channel_file_model=Gtk3::TreeStore->new('Glib::String','Glib::String');
$channel_file_view=Gtk3::Treeview->new
-- list of files as below;
my @list;
my %dirdvb;
foreach my $prefix_conf (@prefix_conf){
#my $prefix_conf;
my (undef,$prefix_conf_sys,undef)=File::Basename::fileparse($prefix_conf);
$dirdvb{$prefix_conf_sys}=undef;
}
#print 'prefix ',$prefix_conf_sys,"\n";
foreach my $prefix_conf_sys (keys %dirdvb){
my @listi=`ls -1 $prefix_conf_sys`;
foreach my $list1 (@listi){
push @list, [$list1,$prefix_conf_sys]
}
}
--setup renderer - otherwise 2nd column doesnt show at all
my $renderer1 = Gtk3::CellRendererText->new;
$channel_file_view->pack_start ($renderer1, 'TRUE');
$channel_file_view->add_attribute ($renderer1, text => 1);
--finally add lines to combobox
sub add_combo {
my ($combo,$val1,$val2,$chk)=@_;
my $iter=$combo->append(undef);
my $cnt=0;
foreach my $val ($val1,$val2){
$combo->set($iter,$cnt,$val);
$cnt++;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]