kranthi has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/local/bin/perl use Tk; use Tk::BrowseEntry; my $mw = new MainWindow; $mw->title("Main Window"); my $frame1 = $mw->Frame()->pack(-side => 'top' ); #List for Browse Entry my @List = ("First window","Second Window","Third Window", "Last Windo +w"); $browseentry = $frame1 ->BrowseEntry( -label => "Select Window:", -listheight=> 4, -variable => \$Win_value, -browsecmd => \&Create_Window) ->pack(-side =>'left', -ipady => 5, -pady=>15) +; $browseentry->insert('end', @List); $frame2 = $mw->Frame()->pack(-side => 'bottom'); my $lbl1 = $frame2->Button(-text => 'Close', -command =>sub {$mw->destroy()}) ->pack(-pady =>10); MainLoop; sub Create_Window { our %Window_Info; our $flg = 0; our $my_Win = @_; our $frm1 = join '', @_[1],"_frm1"; our $frm2 = join '', @_[1],"_frm2"; our $caption = join '', @_[1],"_Details"; while (($key, $val) = each(%Window_Info)) { if($key eq @_[1]){ $flg=1; $val ->deiconify( ); $val ->raise( ); } } if ($flg == 0){ $my_Win = $mw ->Toplevel(); $my_Win ->title("$caption"); $my_Win->minsize(qw(800 500)); $my_Win->focus(); #Storing the values in the Hash table $Window_Info{@_[1]}=$my_Win; $frm2 = $my_Win->Frame()->pack(-side => 'bottom' ); #opens the save file dialog wrt the selected toplevel. $frm2->Button(-text => 'Save', -command =>sub {SaveFile($my_Wi +n)})->pack(-side=>'left'); #closes the selected window $frm2->Button(-text => 'Close', -command =>sub {$my_Win->destr +oy()})->pack(-side=>'left'); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Unable to delete a specified toplevel
by Erez (Priest) on Jun 11, 2008 at 10:56 UTC | |
|
Re: Unable to delete a specified toplevel
by GrandFather (Saint) on Jun 11, 2008 at 11:28 UTC | |
|
Re: Unable to delete a specified toplevel
by Anonymous Monk on Jun 11, 2008 at 11:08 UTC |