Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Tk::Notebook exclude tab from focus traversal

by tybalt89 (Prior)
on Nov 26, 2018 at 21:20 UTC ( #1226392=note: print w/replies, xml ) Need Help??


in reply to Tk::Notebook exclude tab from focus traversal

Here's a version that allows shift-tab to go backwards properly, that is, it works both forward and backwards.

#!/usr/bin/perl # https://perlmonks.org/?node_id=1226322 use strict; use warnings; use Tk; require Tk::NoteBook; my $main = MainWindow->new( ); my $nb = $main->NoteBook(-takefocus => 0 )->pack(-expand => 1, -fill = +> 'both'); my $page1 = $nb->add('page1', -label => 'Page 1'); my $one = $page1->Entry()->pack(); $page1->Entry()->pack(); my $three = $page1->Entry()->pack(); $page1->Entry()->pack(); $three->bind('<Tab>' => sub { $main->after( 0, sub {$one->focus} ) } ) +; $one->bind('<<LeftTab>>' => sub { $main->after( 0, sub {$three->focus} + ) } ); $nb->add('page2', -label => 'Page 2'); MainLoop;

Replies are listed 'Best First'.
Re^2: Tk::Notebook exclude tab from focus traversal
by cscvrp (Novice) on Nov 27, 2018 at 05:28 UTC
    While it turns out the takefocus works if you just apply it to the right place as beech shows, this was very helpful in helping me think about managing focus, and I'm going to need this soon in some soon to tackle problems elsewhere. Thanks for your time, much appreciated!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1226392]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2021-01-16 00:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?