Hi Guys! I'm new here & also new to Perl world.. Actually I'm an Electronics Engineer (ASIC Design) & I started playing with Perl/TK as I need to build a GUI tool for running my simulations.. Please take a look at the below: I've built a little MainWindow in which I can open several Tabs NoteBooks). Each Tab is differently named by the user and should consist its own Button. The problem is that I do not know how to "tie" the Buttons into the Page (Tab) they displayed on i.e. If you open a Tab labeled "1" & click Buttons "Option1" & "Option3", and now you open a new Tab labeled "2" - you'll see that Buttons "Option1" & "Option3" are activated... How do I grant a unique variable to Buttons of each Page? Best Regards, Ronen
#!/usr/local/bin/perl use Tk; use Tk::NoteBook; use Tk::DialogBox; use Tk::LabEntry; $mw = MainWindow->new(); $mw->title("TEST"); $mw->geometry( "400x300"); $mw->configure(-menu => my $menubar = $mw->Menu); my $file = $menubar->cascade(-label => '~File'); $file->command( -label => 'New Test', -underline => 0, -command => \&new_test, ); $file->separator; # -------------------------------------------------------------------- +--------------------------- ## Create the notebook and fill the whole window $nb = $mw->NoteBook()->pack(-expand => 1, -fill => 'both'); MainLoop; # Open new Single Test Run Tab subroutine sub new_test { # Popup for selecting name for new Tab $db = $mw->DialogBox(-title => "Select Test Name", -buttons => ["OK", +"Cancel"]); $db->add('LabEntry', -textvariable => \$test_name, -width => 20, -label => 'Test Label:', -labelPack => [-side => 'left'])->pa +ck; $db->Show( ); # Create the notebook and fill the whole window # Page 1 on the Notebook, with buttons on that page $p1 = $nb->add($test_name, -label => $test_name); $lbl_0 = $p1 -> Label(-text=>"$test_name Options:") -> place(-x => 0, +-y => 100); $rdb_1 = $p1 -> Checkbutton(-text=>"Option1", -variable=>\$option1) -> + place(-x => 100, -y => 100); $rdb_2 = $p1 -> Checkbutton(-text=>"Option2", -variable=>\$option2) -> + place(-x => 100, -y => 120); $rdb_3 = $p1 -> Checkbutton(-text=>"Option3", -variable=>\$option3) -> + place(-x => 100, -y => 140); }
In reply to Perl/TK NoteBook Q. by ronene1972
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |