in reply to Entry widget does not work in 5.18.1

Just a guess, but I'm betting you have a focus problem. Try clicking the mouse in the entry first, or tabbing around. Try adding $f->focus to force the last entry to have focus. You might want to name your entries better, like $f{'Name'} so you can assign focus order better.

Some code to show what happens:

#!/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();

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

Replies are listed 'Best First'.
Re^2: Entry widget does not work in 5.18.1
by rjohn1 (Sexton) on Jan 10, 2014 at 12:14 UTC

    Hi zentara, I tried putting focus just on the last entry and execute. But still other than cursor blinking at last entry widget keyboard input does not reflect in the entry. Thanks for looking. I am at a total loss

      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.