Takamoto has asked for the wisdom of the Perl Monks concerning the following question:
Dear monks
I use the following (simplified) code to be able to decide the order of widget switching when using the TAB key. This works fine except when the cursor enters a text widget. Here the tab has its own behavior (inserting a tab in a text), which makes sense. However, in my application, I would like to overwrite this behavior and would like the tab to allow further switching. Any idea?
use strict; use warnings; use Tk; my $mw = MainWindow->new(); my $entry1 = $mw->Entry()->pack(); my $entry2 = $mw->Entry()->pack(); my $entry3 = $mw->Entry()->pack(); my $text = $mw->Scrolled('Text')->pack(); my %after = ( $entry1 => $entry3, $entry3 => $entry2, $entry2 => $text, $text => $entry1, ); $mw -> bind('all','<Tab>',sub{ ($after{$_[0]} // $_[0])->focus; } ); $mw->MainLoop(); exit(0);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Tk bind key scrolled Text
by jcb (Parson) on Sep 15, 2019 at 23:41 UTC | |
by Takamoto (Monk) on Sep 16, 2019 at 06:19 UTC | |
by jcb (Parson) on Sep 16, 2019 at 22:45 UTC | |
|
Re: Tk bind key scrolled Text
by tybalt89 (Monsignor) on Sep 16, 2019 at 08:53 UTC | |
|
Re: Tk bind key scrolled Text
by Anonymous Monk on Sep 16, 2019 at 07:18 UTC |