Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks,
I can not figure out how I can dinamically set the -choices option of a Tk::JComboBox. This is a basic JComboBox code snippet.
use strict; use warnings; use Tk; use Tk::JComboBox; my $main = MainWindow->new (-title => "Test JComboBox"); my %TableHeaders=(1=>"English", 2=>"French", 3=>"German", 4=>"Undef", +5=>"Undef"); my $Language1; my $main ->JComboBox( -textvariable => \$Language1, -choices => [ {-name => $TableHeaders{1}, -value => 1}, {-name => $TableHeaders{2}, -value => 2}, {-name => $TableHeaders{3}, -value => 3}, {-name => $TableHeaders{4}, -value => 4}, {-name => $TableHeaders{5}, -value => 5}, ], )->pack();
In the previous code I want to be able to dynamically control the -choices so that, in my example, "Undef" values of %TableHeaders are not print (i.e. I will have only three elements in -choices). Any suggestions?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Tk::JComboBox -choices option
by haukex (Archbishop) on Jun 11, 2017 at 14:54 UTC | |
by Anonymous Monk on Jun 11, 2017 at 19:10 UTC | |
|
Re: Tk::JComboBox -choices option
by tybalt89 (Monsignor) on Jun 11, 2017 at 15:01 UTC |