#!/usr/bin/perl use Tk; #use strict; require Tk::NoteBook; require Tk::LabEntry; require Tk::Scrollbar; our $mw = MainWindow->new; $mw->geometry("800x1000"); my $canvas = $mw->Scrolled('Canvas', -scrollbars => "s")->pack(-fill => 'both', -expand => 1); $mw->withdraw(); $mw->Popup; # Create the NoteBook and add 2 pages, which are really # Frames with tabs. Given that, we create LabEntry # widgets and pack them as usual. our $n = $canvas->NoteBook(-dynamicgeometry => 'true')->pack( -fill=>'both', -expand=>1); $n->pack( -expand => "yes", -fill => "both", -side => "top" ); for ( 1 .. 20 ){ my $title = "mytab $_"; #$n->add( $_, -label => $title ); $_ = create_tab("$title"); create_tab_labentry($_, \$folder_name, "folder name: "); } ### embed the notebook widget into the canvas my $nb_in_canvas = $canvas->createWindow( 0, 0, -window => $n, -anchor => 'nw' ); $canvas->update; ### the whole notebook is larger than what can be initially displayed ### so we'll have to sroll it later on in the program $canvas->configure( -scrollregion => [0,0,$n->reqwidth,$n->reqheight]); sub create_tab { my $tabname = shift; my $tn = $n->add($tabname, -label => $tabname, -underline => 0); $t = $tn->Scrolled("Text", -scrollbars => "e", -wrap => 'none')->pack(-expand => 1, -fill => 'both'); $t->tagConfigure ('bold', -font => [ -size => 0, -weight => 'bold' ]); return $t; } sub create_tab_labentry { my $tabname = shift; my $fc_address = shift; my $field_label = shift; $w = $tabname->Button(-text => $field_label, -relief => 'raised', -width => 66); $tabname->windowCreate('end', -window => $w); $w = $tabname->Entry(-width => 35, -textvariable => $fc_address); $tabname->windowCreate('end', -window => $w); $tabname->insert('end', "\n"); } MainLoop;