rjohn1 has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks, The below non-working code just asks for the user entry, waiting for it. Now there is a very strange problem i face as described below.
sub pop_user_entry{ $temp_var = ""; my $user_entry_done = 0 ; my $dialog_top = $mw->Toplevel(-title=>"User Entry"); $dialog_top->Entry(-textvariable=>\$temp_var)->pack; $dialog_top->Button(-text=>"OK",-command=>sub {$user_entry_don +e = 1 unless($temp_var =~ m/^$/);})->pack; $dialog_top->waitVisibility; $dialog_top->grab; $dialog_top->waitVariable(\$user_entry_done); $dialog_top->grabRelease ; $dialog_top->destroy; }
The problem is that when pop_user_entry is called, i CANNOT enter into the Entry widget via keyboard. But strangely if i pack the Button before Entry, then all works fine. Working Code:
But because of common sense, i want the Entry before Button as shown in original code which does not work. Please let me know if you can spot the problem in the original code:$dialog_top->Button(-text=>"OK",-command=>sub {$user_entry_done = 1 un +less($temp_var =~ m/^$/);})->pack; $dialog_top->Entry(-textvariable=>\$temp_var)->pack;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: A very strange problem with entry, button widgets along with waitvariable(\$X)
by Anonymous Monk on Nov 15, 2013 at 05:29 UTC | |
|
Re: A very strange problem with entry, button widgets along with waitvariable(\$X)
by kcott (Archbishop) on Nov 16, 2013 at 18:46 UTC | |
by rjohn1 (Sexton) on Nov 18, 2013 at 06:27 UTC | |
by kcott (Archbishop) on Nov 18, 2013 at 12:05 UTC | |
by rjohn1 (Sexton) on Nov 19, 2013 at 04:03 UTC |