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?