in reply to Re: A very strange problem with entry, button widgets along with waitvariable(\$X)
in thread A very strange problem with entry, button widgets along with waitvariable(\$X)
Hi Ken, I am putting the header code here. This is just temp code i created to post here.
use Tk; use warnings; use strict; use Getopt::Long; use Cwd; use List::Util qw<first>; require Tk::ROText; my $temp_var = ""; my $mw = MainWindow->new(); $mw->geometry("1200x1200+0+680"); $mw->title("SVN Util"); $mw->resizable(0,1); $mw->Button(-text=>"Test", -command=>\&pop_user_entry)->pack; MainLoop; 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; }
As i said if you flip the button and entry widget declaration in the method definition, the entry widget takes the keyboard input.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: A very strange problem with entry, button widgets along with waitvariable(\$X)
by kcott (Archbishop) on Nov 18, 2013 at 12:05 UTC | |
by rjohn1 (Sexton) on Nov 19, 2013 at 04:03 UTC |