in reply to tk:table get active cell

Hi, first in your example, it's "use Tk::Table;"

Second, Tk::TableMatrix is a better widget, and you can get active cells with it, with

myTableMatrix->index('active');

There are some ideas in how to disable the button untill certain fields are filled?

To get current cell, you can do something like

#!/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('<ButtonPress-1>' => sub{ $x = $col; $y = $row }); } } my $button = $mw->Button(-text => 'Get Current', -command => sub{ print "$x $y\n"; })->pack(); MainLoop;
also look at this example
#!/usr/bin/perl use warnings; use strict; use Tk; use Tk::Table; my $mw= tkinit; #$mw->geometry("400x400+100+100"); my $table = $mw->Scrolled('Table', -rows =>4, -columns => 4, -fixedrows => 5, #trick to hide scrollbars -fixedcolumns => 5, -scrollbars => 'osoe', -takefocus => 1,)->pack(-fill=>'both', -expand=>1); my %widgets; for my $row(1..4){ for my $col(1..4){ $widgets{$row}{$col} = $table->Button( -text=> "$row - $col", -background => 'white', -command => sub{ do_me($row,$col) } ); $table->put( $row,$col,$widgets{$row}{$col} ); } } MainLoop; sub do_me{ my ($row, $col) = @_; print "$row $col\n"; }

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh