use strict; use Tk; my $mw= new MainWindow::; my @version= (2,0,0,''); my $date= "21-Nov-2002"; my $option= 'analyze'; my ($directory)= "blah blah"; my $textbox; my $checkout_command= "foo bar %f"; sub params_box { my $top= $mw->Frame; my $f2= $top->Frame()->pack (-side=>'left', -anchor=>'n', -pady=>5); # Iteration/Revision/Patch info my $f1= $f2->Frame()->pack (-side => 'top', -pady=>2); $f1->Label (-text => "Iteration: ")->pack (-side => 'left'); $f1->Entry (-width=>3, -textvariable=>\$version[0] )->pack (-side => 'left'); $f1->Label (-text => "Revision: ")->pack (-side => 'left'); $f1->Entry (-width =>3, -textvariable=>\$version[2] )->pack (-side => 'left'); $f1= $f2->Frame->pack (-side=>'top', -anchor=>'w', -pady=>2); $f1->Label (-text => "Patch Level: ")->pack (-side =>'left'); $f1->Entry (-width=>3, -textvariable=>\$version[3])->pack (-side=>'left', -expand=>1, -fill=>'x'); # Release Date $f1= $f2->Frame->pack (-side => 'top', -pady=>2); $f1->Label (-text => "Release Date:")->pack (-side => 'left'); $f1->Entry (-width => 12, -textvariable=>\$date)->pack (-side => 'left'); # make a stack of buttons $f2= $top->Frame()->pack(-side => 'left', -padx=>7, -pady=>5, -anchor=>'n'); $f2->Button (-text => 'Go', -width => 10, -pady => 0, -command => \&go ) ->pack (-side => 'top', -expand => 1, -padx => 1, -pady => 1); $f2->Button (-text => 'Exit', -width => 10, -pady => 0, -command => \&exit ) ->pack (-side => 'top', -expand => 1, -padx => 1, -pady => 1); $f2->Button (-text => 'Clear', -width => 10, -pady => 0, -command => sub{print OUTPUT "\x19"} ) ->pack (-side => 'top', -expand => 1, -padx => 1, -pady => 1); # the options $f2= $top->Frame (-relief=>'groove', -borderwidth=>2)->pack(-side=>'left'); $f2->Radiobutton (-text => 'Check files out of Continuus', -value=>'checkout', -variable=>\$option) ->pack (-side => 'top', -anchor=>'w'); $f2->Radiobutton (-text => 'Defeat R attribute on read-only files', -value=>'defeat', -variable=>\$option) ->pack (-side => 'top', -anchor=>'w'); $f2->Radiobutton (-text => 'analyze only (don\'t modify files)', -value=>'analyze', -variable=>\$option) ->pack (-side => 'top', -anchor=>'w'); $f2->Radiobutton (-text => 'write different files (for testing)', -value=>'temp', -variable=>\$option) ->pack (-side => 'top', -anchor=>'w'); # other fields $f2= $top->Frame()->pack(-side=>'right', -fill=>'x', -expand=>1, -anchor=>'n', -pady=>5); $f2->Label (-text => 'Working Directory:', -anchor=>'e') -> grid ( $f2->Entry (-textvariable=>\$directory), -sticky => 'ew'); $f2->Label (-text => 'CheckOut Command:', -anchor=>'e') -> grid ( $f2->Entry (-textvariable=>\$checkout_command), -sticky => 'ew'); $f2->gridColumnconfigure (1, -weight=>1); return $top; } sub setup_main_window { params_box()->pack (-side => 'top', -anchor=>'w', -expand=>1, -fill=>'x'); $textbox= $mw->Scrolled ('ROText', -scrollbars=>'ose', -height=>20, -width=>132) -> pack (-side=>'bottom', -expand=>1, -fill=>'both') ->Subwidget ('rotext'); } setup_main_window(); $textbox->insert ('end', "blah blah blah $_\n") for (1..50); MainLoop();