roho has asked for the wisdom of the Perl Monks concerning the following question:
The example code below creates 3 Tk Notebook widget tabs in a Toplevel window. None of the tabs have focus, which means the contents must be clicked on before scrolling can occur. The Notebook tabs can only be navigated by clicking on the tab headers.
My questions are:
TIA for your help.
#!/usr/bin/perl use strict; use warnings; use Tk; use Tk::Menu; use Tk::More; use Tk::NoteBook; my $mw = MainWindow->new(); $mw->geometry("100x100+850+50"); $mw->iconify; my $bw = $mw->Toplevel(); $bw->geometry("850x200+500+200"); $bw->bind('<Destroy>' => sub {exit;}); $bw->bind('<Escape>' => sub {exit;}); my $book = $bw->NoteBook()->pack( -fill=>'both', -expand=>1 ); my $tab1 = $book->add( "Sheet 1", -label=>"Tab #1" ); my $more1 = $tab1->Scrolled("More", -scrollbars => "osoe" )->pack(-fil +l => "both", -expand => 1); my $menu1 = $more1->menu; $bw->configure(-menu => $menu1); $more1->Load( $0 ); my $tab2 = $book->add( "Sheet 2", -label=>"Tab #2" ); my $more2 = $tab2->Scrolled("More", -scrollbars => "osoe" )->pack(-fil +l => "both", -expand => 1); my $menu2 = $more2->menu; $bw->configure(-menu => $menu2); $more2->Load( $0 ); my $tab3 = $book->add( "Sheet 3", -label=>"Tab #3" ); my $more3 = $tab3->Scrolled("More", -scrollbars => "osoe" )->pack(-fil +l => "both", -expand => 1); my $menu3 = $more3->menu; $bw->configure(-menu => $menu3); $more3->Load( $0 ); MainLoop;
"It's not how hard you work, it's how much you get done."
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Navigation and Focus - Tk Notebook Widget tabs
by roho (Bishop) on Aug 31, 2020 at 01:09 UTC | |
by perlfan (Parson) on Aug 31, 2020 at 23:28 UTC | |
by roho (Bishop) on Sep 01, 2020 at 00:40 UTC | |
by soonix (Chancellor) on Sep 01, 2020 at 22:02 UTC | |
|
Re: Navigation and Focus - Tk Notebook Widget tabs (UPDATED)
by Anonymous Monk on Sep 04, 2020 at 03:00 UTC |