Here is how I would do it using tags. Tags are kind of tricky ( notice I needed the tagRaise to make the example below work). But this is much faster, because it dosn't make all those Label and Button widgets. Tags are used in the Canvas, Text, and a few other widgets, they are very powerful if used correctly. You should read the perldoc Tk::TableMatrix section on tags, and play with them. To really make them work, you usually need to read the tags on the row,column or cell, then delete out a tag temporarily, then put it back, etc,etc....it can be a real juggling act, but it is simple once you get a scheme going.
#!/usr/bin/perl use Tk; use Tk::TableMatrix; use strict; use warnings; my $arrayVar = {}; print "Filling Array...\n"; my ($rows,$cols) = (6, 500); foreach my $row (1..$rows){ $arrayVar->{"$row,0"} = "$row"; } foreach my $col (1..$cols){ $arrayVar->{"0,$col"} = "$col"; } my $mw = MainWindow->new; my $table = $mw->Scrolled( "TableMatrix", -resizeborders => 'none', -titlecols => 1, -rows => 7, -colstretchmode => 'all', -cols => 501, -cache => 1, -scrollbars => "osoe", -variable => $arrayVar, )->pack( -expand => 1, -fill => 'both'); $table->tagConfigure('dis', -state => 'disabled', -bg => 'white'); $table->tagConfigure('act', -state => 'normal', -bg => 'lightyellow'); foreach my $col(1..500) { foreach my $row(1..7) { # $table->set("$row,$col","$row-$col"); $table->tagCell('dis',"$row,$col"); if($row == 4){ $table->set("$row,$col",'Active'); $table->tagCell('act',"$row,$col"); } } } my $button = $mw->Button(-text=>'Activate Row 2', -command=>sub{ # $table->tagDelete('dis', 2); $table->tagRow('act', 2); $table->tagRaise('act'); })->pack(); MainLoop; __END__

I'm not really a human, but I play one on earth Remember How Lucky You Are

In reply to Re: Non editable cells in Tk::TableMatrix by zentara
in thread Non editable cells in Tk::TableMatrix by ravishi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.