http://www.perlmonks.org?node_id=958524


in reply to Re: Optionmenu Variable in Name
in thread Optionmenu Variable in Name

Thank you for the response. I am trying to create 3 different option menus. In the big picture, there will be a maximum number of optionmenus available but all disabled. When the user types in the entry, in this case, 1 2 or 3, that number of optionmenus are enabled. Here is a working code. The sub input_lam_data is where I'd like to replace the three configure commands with a loop.

use Tk; # Variables my $lam_num; my $ort1; my $ort2; my $ort3; # Main Window my $mw = new MainWindow; # Build GUI my $lam_mat_frm = $mw -> Frame(); my $lam_num_ent = $lam_mat_frm -> Entry(), -variable=> \$lam_num; my $ort_optmen1 = $lam_mat_frm -> Optionmenu(-options => [qw(-45 0 45 +90)], -variable => \$ort1); my $ort_optmen2 = $lam_mat_frm -> Optionmenu(-options => [qw(-45 0 45 +90)], -variable => \$ort2); my $ort_optmen3 = $lam_mat_frm -> Optionmenu(-options => [qw(-45 0 45 +90)], -variable => \$ort3); $ort_optmen1 -> configure(-state => 'disabled'); $ort_optmen2 -> configure(-state => 'disabled'); $ort_optmen3 -> configure(-state => 'disabled'); my $lam_data_button = $lam_mat_frm->Button(-text=>"Input Laminate Data +", -command=> \&input_lam_data); # Geometry Management $lam_mat_frm -> grid(-row=>1, -column=>1, -columnspan=>2); $lam_num_ent -> grid(-row=>1,-column=>1); $ort_optmen1 -> grid(-row=>2,-column=>1); $ort_optmen2 -> grid(-row=>3,-column=>1); $ort_optmen3 -> grid(-row=>4,-column=>1); $lam_data_button -> grid(-row=>5,-column=>1); MainLoop; sub input_lam_data { $ort_optmen1 -> configure(-state => 'normal'); $ort_optmen2 -> configure(-state => 'normal'); $ort_optmen3 -> configure(-state => 'normal'); }

Thank you.