#!/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('' => sub { $main->after( 0, sub {$one->focus} ) } ); $one->bind('<>' => sub { $main->after( 0, sub {$three->focus} ) } ); $nb->add('page2', -label => 'Page 2'); MainLoop;