Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Tk::Notebook exclude tab from focus traversal

by tybalt89 (Monsignor)
on Nov 26, 2018 at 21:20 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1226392]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-24 12:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found