Output:use Tk; my $test1; my $var = "55"; $mw = MainWindow->new(); $FrameOpt = $mw -> Frame; my $exit_b = $mw->Button(-text => 'Exit', -command => sub { exit })->pack; $mw->Button(-text => "Toggle Textbox", -command => sub { my $state = $test1 -> Entry -> configure(-state); print "$state\n"; if ($state eq "disabled") { $test1 -> Entry -> configure(-state => 'normal') } else { $test1 -> Entry -> configure(-state => 'disabled') } })->pack; sub GuiTextEntryLabelOnLeftCreate { my ($frame, %x_args) = @_; my $label; my $text = $x_args{'-text'}; delete $x_args{'-text'}; $label = $frame -> Label ( -text => $text, -foreground => "black" ) -> grid ( $frame -> Entry (%x_args) , -sticky => 'w' , -pady => 2 ); $label; } $test1 = &GuiTextEntryLabelOnLeftCreate ( $FrameOpt , -text => "Test value" , -textvariable => \$var , -width => 6, -state => "disabled", -foreground => "gray" ); $FrameOpt->pack; MainLoop();
As you can see, I'm having trouble isolating the state of the Entry widget inside the combo: $state is actually an array, and if I print the array I can see "normal" as one of the array elements, which is incorrect, so for sure it's not the correct state. Is there a way for me to get access to Entry -> state, or do I have to create some other combo widget with easier access? Thanks!ARRAY(0x67e4b98)
In reply to Changing state for gridded Entry? by cniggeler
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |