Thanks Zentara!!!
I have tried the above approach, but not working.
try the code below.
use strict;
use warnings;
use Tk;
use Tk::Table;
use Tk::Pane;
use constant COLUMNS => 5;
my $mw = MainWindow->new();
$mw -> resizable (0,0);
$mw -> geometry ("+10+10");
$mw -> geometry ("750x500");
my $spane = $mw->Scrolled('Pane',
-scrollbars => 'oe', -bg => "orange"
)->pack(-expand => 1, -fill => 'both');
#my $yscrollbar = $spane->Subwidget('yscrollbar');
#$yscrollbar->focus;
my $local_title = $mw->title ("perl: New File");
my $basic_label = $spane->Label (
-text => "Old Names",
-font => "verdanafont 10 bold",
-relief => "groove"
) -> pack (
-side => "top",
-anchor => "nw",
-pady => "10",
-padx => "5",
-ipadx => "5"
);
my $table_frame = $spane->Frame ()->pack (-side => "top", -padx => "10
+");
our $table = $table_frame->Table (
-columns => COLUMNS,
-rows => 10,
-scrollbars => "o",
-fixedrows => 1,
-fixedcolumns => 1,
-relief => 'raised',
-pady => "20",
-takefocus => "0"
);
for my $col_index (1 .. COLUMNS - 1)
{
my $col_label = $table->Label (
-text => "$col_index",
-width => 20,
-relief =>'ridge'
);
$table->put (0, $col_index, $col_label);
}
our $table_frame_two = $spane->Frame ();
our $table_two = $table_frame_two ->Table (
-columns => COLUMNS,
-rows => 10,
-scrollbars => "o",
-fixedrows => 1,
-fixedcolumns => 1,
-relief => 'raised',
-takefocus => "0",
-pady => "5"
);
for my $col_index_2 (1 .. COLUMNS - 1)
{
my $col_label_2 = $table_two->Label(-text => "$col_index_2 ", -wid
+th => 20,
-relief =>'ridge');
$table_two->put(0, $col_index_2, $col_label_2);
}
my $button_frame = $spane->Frame (-bg => "red")->pack (
-side => "bottom",
-fill => "both",
-anchor => "sw",
-pady => "10",
-padx => "20"
);
our $adv_button = $spane->Button (
-text => "New Names",
-font => "verdanafont 10 bold",
-command =>
sub
{
if ($table_frame_two ->ismapped)
{
$table_frame_two -> packForget();
}
else
{
$table_frame_two -> pack();
}
}
)->pack (
-side => "top",
-anchor => "w",
-pady => "15",
-padx => "5"
);
our $enter_button = $button_frame -> Button (
-text => "Enter",
-font => "verdanafont 10 bold"
)->pack (
-side => "left",
-padx => "5",
-ipadx => "5"
);
our $exit_button = $button_frame -> Button(-text=>"Exit",
-font => "verdanafont 10 bold")
-> pack(-side=>"right",-padx=>"5",
-ipadx=>"5");
for my $col_entry (1 .. COLUMNS - 1)
{
for my $row_entry (1 .. 10 - 1)
{
my $ent = $table->Entry (
-font => "verdana 10",
)-> pack (
-ipady => "15");
$table->put ($row_entry,$col_entry,$ent);
}
}
$table->pack ();
for my $col_entry_2 (1 .. COLUMNS - 1)
{
for my $row_entry_2 (1 .. 10 - 1)
{
my $ent_2 = $table_two->Entry (
-font => "verdana 10",
)-> pack (
-ipady => "15");
$table_two->put ($row_entry_2,$col_entry_2,$ent_2);
}
}
$table_two->pack ();
MainLoop();
thanks in advance.. |