#!/usr/bin/perl use warnings; use strict; use Tk; use Tk::Table; #The key point is that the scroll bars only scroll non-fixed columns. my $mw = MainWindow->new; #$mw->geometry("200x200"); my $x; my $y; my $table = $mw->Table (-rows => 9, -columns => 9, -fixedrows => 9)->pack; foreach my $row (0 .. 8) { foreach my $col (0 .. 8) { my $cell = $table->Entry (-width => 4, -text => "$col, $row"); $table->put ($row, $col, $cell); $cell->bind('' => sub{ $x = $col; $y = $row }); } } my $button = $mw->Button(-text => 'Get Current', -command => sub{ print "$x $y\n"; })->pack(); MainLoop;