Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

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 # 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?

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-07-22 09:12 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.