Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re^2: Non editable cells in Tk::TableMatrix

by NateTut (Deacon)
on Jun 23, 2011 at 20:06 UTC ( #911149=note: print w/replies, xml ) Need Help??

in reply to Re: Non editable cells in Tk::TableMatrix
in thread Non editable cells in Tk::TableMatrix

Has anyone ever used row tags with TableMatrix?

Replies are listed 'Best First'.
Re^3: Non editable cells in Tk::TableMatrix
by zentara (Archbishop) on Jun 23, 2011 at 20:18 UTC
    Row tags are pretty straightforward, and work almost like regular tags, except they affect all columns. What sort of thing are you trying to accomplish? Here is a simple example.
    #!/usr/bin/perl use Tk; use Tk::TableMatrix; my $mw = MainWindow->new; my $arrayVar = {}; print "Filling Array...\n"; my ($rows,$cols) = (10, 10); foreach my $row (0..($rows-1)){ foreach my $col (0..($cols-1)){ $arrayVar->{"$row,$col"} = "$row,$col"; } } print "Creating Table...\n"; ## Test out the use of a callback to define tags on rows and columns sub colSub{ my $col = shift; return "OddCol" if( $col > 0 && $col%2) ; } my $t = $mw->Scrolled('TableMatrix', -rows => $rows, -cols => $cols, -width => 6, -height => 6, -titlerows => 1, -titlecols => 1, -variable => $arrayVar, -coltagcommand => \&colSub, -colstretchmode => 'last', -rowstretchmode => 'last', -selectmode => 'extended', -selecttitles => 0, -drawmode => 'slow', -scrollbars=>'se' ); $mw->Button(-text => "Update", -command => \&update_table) ->pack(-side => 'bottom',-anchor => 'w'); # hideous Color definitions here: $t->tagConfigure('active', -bg => 'white', -relief => 'sunken'); $t->tagConfigure('OddCol', -bg => 'lightyellow', -fg => 'black'); $t->tagConfigure('title', -bg => 'lightblue', -fg => 'black', -relief +=> 'sunken'); $t->tagConfigure('dis', -state => 'disabled'); $t->pack(-expand => 1, -fill => 'both'); $t->focus; Tk::MainLoop; # $t->tagConfigure($anchor, -anchor => $anchor); # $t->tagRow($anchor, ++$i); # $t->set( "$i,$first",$anchor); sub update_table { print "1\n"; $t->tagCell('dis', '1,1' ); $t->activate('2,2'); $t->tagRow('active',3); # $t->configure(-padx =>( $t->cget(-padx))); # a trick needed sometimes to update }

    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh
      Thank you. I was able to get it figured out by combining a couple of your samples. Basically I just want to gang all the cells together. It's really dumbing down a lot of the capabilities of TableMatrix, but I am working with spreadsheet data & I like the "cellular" look of TableMatrix. This is my first production Tk project and I've worked with it enough now that it is starting to make sense to me. Give a monkey a typewriter and eventually he will write War and Peace.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://911149]
Lady_Aleena throws in the proverbial towel.

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2017-04-26 06:46 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (469 votes). Check out past polls.