Is there a more efficient way of setting every cell to just a blank window and not an editable field. I looked in the perldoc pages and tried using -state => disabled but that didn't seem to let me use -insertRows and -insertCols.#!/usr/bin/perl use Tk; use Tk::TableMatrix; use strict; use warnings; my $mw = MainWindow->new; my $table = $mw->Scrolled("TableMatrix", -resizeborders=>'non +e', -titlecols => 1, -rows => 6, -colstretchmode=>'al +l', -cols => 1, -cache => 1, -scrollbars => "osoe +"); for(my $col = 1; $col < 500; $col++) { $table->insertCols("$col.0", 1); my $button = $table->Button(-text => "$col enabled", -command +=> sub {$table->see("0,300"); + } ); #initialy fill table with blank windows. Section to improve my $blank = $table->Label(-text => "", -background => 'white', + -cursor => ['left_ptr']); $table->windowConfigure("0,$col", -window => $blank, -sticky = +> 'nsew'); $blank = $table->Label(-text => "", -background => 'white', -c +ursor => ['left_ptr']); $table->windowConfigure("1,$col", -window => $blank, -sticky = +> 'nsew'); $blank = $table->Label(-text => "", -background => 'white', -c +ursor => ['left_ptr']); $table->windowConfigure("2,$col", -window => $blank, -sticky = +> 'nsew'); $blank = $table->Label(-text => "", -background => 'white', -c +ursor => ['left_ptr']); $table->windowConfigure("3,$col", -window => $blank, -sticky = +> 'nsew'); $blank = $table->Label(-text => "", -background => 'white', -c +ursor => ['left_ptr']); $table->windowConfigure("4,$col", -window => $blank, -sticky = +> 'nsew'); $blank = $table->Label(-text => "", -background => 'white', -c +ursor => ['left_ptr']); $table->windowConfigure("5,$col", -window => $blank, -sticky = +> 'nsew'); #fill each column with a button with random row placement my $row = int(rand(5)); $table->windowConfigure("$row,$col", -window => $button, -stic +ky => 'nsew'); } #set row titles $table->set("0,0", "Col 1"); $table->set("1,0", "Col 2"); $table->set("2,0", "Col 3"); $table->set("3,0", "Col 4"); $table->set("4,0", "Col 5"); $table->set("5,0", "Col 6"); $table->pack(-expand => 1, -fill => 'both'); MainLoop;
I have found the TableMatrix module to be the best module for what I want compared to Tk::Table, Tk::Grid, and Tk::Hlist so I would not like to switch modules.
In reply to Non editable cells in Tk::TableMatrix by ravishi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |