in reply to more than one DynaTabFrame

Here is an example using plain Notebook tabs. I would guess that DynaTabFrame would work just as well as Notebook, just substitute it in.

The main problem with these widgets, is you need to pack them after all of them are constructed, so the window manager knows how much size to allocate, otherwise they get set to a small size, and get crushed. I used many scalars in this script, it probably should use a hash for storing refs... like $myhash{'frame1'}{'nb'}{'page5'}{etc}

#!/usr/bin/perl use warnings; use strict; use Tk; use Tk::NoteBook; use Tk::Pane; use Tk::LabFrame; my $mw = new MainWindow; $mw->geometry("500x500"); my $pane = $mw->Scrolled('Pane', -scrollbars=>'osoe', sticky=>'nwse'); my $mf = $pane->Frame; my $nb = $mf->NoteBook(-width=>300); my $nb1 = $nb->add("page1", -label=>"Page 1"); my $nb2 = $nb->add("page2", -label=>"Page 2"); my $nb3 = $nb->add("page3", -label=>"Page 3"); my $nb4 = $nb->add("page4", -label=>"Page 4"); my $nbf1=$nb1->Scrolled('Text', -scrollbars=>'se')->pack; $nbf1->insert('end', "Tab 1"); my $nbf2=$nb2->Label(-text=>"Tab 2")->pack; my $nbf3=$nb3->LabFrame(-label=>"Tab 3", -labelside=>"acrosstop")->pac +k; my $nbf3b1=$nbf3->Radiobutton(-text=>"Radiobutton1")->pack(-anchor=>"n +w"); my $nbf3b2=$nbf3->Radiobutton(-text=>"Radiobutton2")->pack(-anchor=>"n +w"); my $nbf4=$nb4->Canvas(-background=>"yellow")->pack; $nbf4->createText(30,40, -text=>"Tab 4"); # second set my $mfz = $pane->Frame; my $nbz = $mfz->NoteBook(-width=>300); my $nb1z = $nbz->add("page1", -label=>"Page 1"); my $nb2z = $nbz->add("page2", -label=>"Page 2"); my $nb3z = $nbz->add("page3", -label=>"Page 3"); my $nb4z = $nbz->add("page4", -label=>"Page 4"); my $nbf1z=$nb1z->Scrolled('Text', -scrollbars=>'se')->pack; $nbf1z->insert('end', "Tab 1"); my $nbf2z=$nb2z->Label(-text=>"Tab 2")->pack; my $nbf3z=$nb3z->LabFrame(-label=>"Tab 3", -labelside=>"acrosstop")->p +ack; my $nbf3b1z=$nbf3z->Radiobutton(-text=>"Radiobutton1")->pack(-anchor=> +"nw"); my $nbf3b2z=$nbf3z->Radiobutton(-text=>"Radiobutton2")->pack(-anchor=> +"nw"); my $nbf4z=$nb4z->Canvas(-background=>"yellow")->pack; $nbf4z->createText(30,40, -text=>"Tab 4"); #pack them up $nb->pack; $mf->pack; $nbz->pack; $mfz->pack; $pane->pack(-expand=>1, -fill=>'both'); MainLoop;

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

Replies are listed 'Best First'.
Re^2: more than one DynaTabFrame
by liamlrb (Acolyte) on Nov 18, 2010 at 03:17 UTC
        Every time I come and look around or ask a question, your replying.... Thank you