in reply to Perl/Tk:swapping of frames without loosing the data

I suggest posting some code here, so we could see what exactly is getting assigned to the frames and why is the content lost, or how to maintain it

Stop saying 'script'. Stop saying 'line-noise'.
We have nothing to lose but our metaphors.

  • Comment on Re: Perl/Tk:swapping of frames without loosing the data

Replies are listed 'Best First'.
Re^2: Perl/Tk:swapping of frames without loosing the data
by kapsule (Acolyte) on Aug 12, 2008 at 07:20 UTC
    #!/usr/local/bin/perl use Tk; use Tk::Table; use Tk::Entry; my $mw = new MainWindow; my $title = $mw -> title("kapsule"); my $button = $mw-> Button(-text=>"show",-font => "verdanafont 10 bold" +,-command=>\&show_table)->pack(-side=>"top",-anchor => "w",-pady=>"15",-padx=>"5"); MainLoop; sub show_table() { if (!Exists($show_table_frame)) { our $show_table_frame = $mw->Frame()->pack(-side => "top",-fil +l => "both",-anchor => "nw",-padx=>"10"); our $show_table = $show_table_frame->Table(-columns => 3,-rows + => 5,-scrollbars => "o",-fixedrows => 1,-fixedcolumns => 0,-relief => 'raised',-takefocus=>"0",-pady=>"5"); my $tmp_label = $show_table->Label(-text => "Col. 1 ", -width +=> 15, -relief =>'ridge'); $show_table->put(0, 1, $tmp_label); my $tmp_label = $show_table->Label(-text => "Col. 2", -width = +> 15, -relief =>'ridge'); $show_table->put(0, 2, $tmp_label); my $tmp_label = $show_table->Label(-text => "col. 3", -width = +> 15, -relief =>'ridge'); $show_table->put(0, 3, $tmp_label); for($row=1;$row<5;$row++) { for ($col=1;$col<4;$col++) { my $ent = $show_table -> Entry(-font=>"verdana 10") + -> pack(-ipady=>"15"); $show_table->put($row,$col,$ent); } } $show_table->pack(); } else { $show_table_frame->destroy(); } }
    here is the code with which i am facing problem, i have tried pack and pack forget also.
      Try adding use strict; use warnings;.
      If u press button show, again and again frame will come and go, and any data in the frame will also be lost. I want that, data should not be lost. How to do that ? Any suggestions!! Please help..Monks! thanks in Advance