Re: Entry widget does not work in 5.18.1
by zentara (Cardinal) on Jan 10, 2014 at 11:59 UTC
|
#!/usr/bin/perl
use Tk;
use strict;
use warnings;
#changes focus on Return(Enter) key but not Tab
my $win = MainWindow->new();
my $foo = $win->Entry->pack;
my $bar = $win->Entry->pack;
my $baz = $win->Entry->pack;
my $boo = $win->Entry->pack;
my $baa = $win->Entry->pack;
&defineOrder($foo,$baa,$bar,$boo,$baz);
sub defineOrder_old
{
my $widget;
for (my $i=0; defined( $_[$i+1] ); $i++)
{
$_[$i]->bind('<Key-Return>', [\&focus, $_[$i+1]]);
# won't work with Tab
$_[$i]->bind('all', '<Tab>', [\&focus, $_[$i+1]]);
}
# Uncomment this line if you want to wrap around
$_[$#_]->bind('<Key-Return>', [\&focus, $_[0]]);
$_[0]->focus;
}
sub defineOrder
{
my $widget;
for (my $i=0; defined( $_[$i+1] ); $i++)
{
$_[$i]->bind( '<Key-Return>', [\&focus, $_[$i+1]]);
$_[$i]->bind( '<Tab>', [\&focus, $_[$i+1]]);
}
# Uncomment this line if you want to wrap around
$_[ $#_ ]->bind('<Key-Return>', [\&focus, $_[0]]);
$_[ $#_ ]->bind('<Tab>', [\&focus, $_[0]]);
$_[0]->focus;
}
sub focus
{
my ($tk, $self) = @_;
$self->focus;
}
MainLoop();
| [reply] [d/l] |
|
|
| [reply] |
|
|
Actually it is all very strange. I am facing this issue in my office. When i switch to perl 5.8.3, the last entry widget in a multiple entry mega widget takes the input,
rest all of them dont accept the input even if the cursor blinks in the entry boxes.
Now when i switch to Perl 5.18.1, none of the entry boxes takes input, and i realized even Text box is not editable.
But at my home where it all works well(on Ubuntu with different versions of Perl)
Now i can't understand where the problem lies.
| [reply] |
Re: Entry widget does not work in 5.18.1
by Tux (Canon) on Jan 10, 2014 at 11:34 UTC
|
Works fine on my box: screenshot
Enjoy, Have FUN! H.Merijn
| [reply] |
Re: Entry widget does not work in 5.18.1
by choroba (Cardinal) on Jan 10, 2014 at 09:49 UTC
|
What do you mean by "do not take any input"? Are the entries disabled? Or does not the %info get populated?
| [reply] |
|
|
I can't see anything in any of the entry box when i type something.
| [reply] |
|
|
Have you checked it is not just a colour problem?
| [reply] |
|
|
Re: Entry widget does not work in 5.18.1
by kcott (Archbishop) on Jan 12, 2014 at 15:22 UTC
|
G'day rjohn1,
I'm running Perl 5.18.1 and Tk 804.031 on Mac OS X (darwin-thread-multi-2level).
I am unable to reproduce your reported problem.
I ran the code you posted without any changes.
I was able to enter text into all the Entry widgets.
I then modified the Save button as follows:
$f->Button(-text => "Save",
-command => sub { # do something with %info;
use Data::Dump;
dd \%info;
})->pack(-side => 'bottom');
I then ran the script again and was still able to enter text in all fields.
When I hit Save, I got this output which exactly matched what I had entered:
{
Address => 456,
Business_Address => "jkl",
Business_Phone => "zxc",
City => 789,
Company => "fgh",
Name => 123,
Occupation => "asd",
Phone => "uio",
State => "qwe",
Zip => "rty",
}
I always reinstall Tk after upgrading Perl.
If you haven't done this, I recommend you do so.
| [reply] [d/l] [select] |
|
|
Hi Ken,
Thanks for looking into it. I know it works. It works for me on my personal Ubuntu machine. But at my workplace
(i.e Red Hat Entr Linux Server release 5.8(Tikanga))
, it does not work.
Now it is becoming very difficult for me to understand whether the problem lies in my OS, perl/Tk or somewhere else....
Do you know of any definitive place to find the solution for this problem?
Thanks
RJ
| [reply] |
|
|
"Do you know of any definitive place to find the solution for this problem?"
I don't actually know of a "definitive place" as such.
You could try searching the Internet and speaking with your SysAdmins (both obvious and you may already have done this).
I've front-paged this thread which will give it a little more exposure here.
| [reply] |
|
|
|
|
Re: Entry widget does not work in 5.18.1 (upgrade Tk version)
by Anonymous Monk on Jan 10, 2014 at 10:11 UTC
|
| [reply] |
|
|
| [reply] |
|
|
My Platform is Linux(GNOME)
| [reply] |
|
|