Tk-EMatrix-0.01 - Perl widget derived from Tk::TableMatrix.
use EMatrix; my $titleHash = { "0,0" => "Header1", "0,1" => "Header2", "0,2" => "Header3", "0,3" => "Header4", "0,4" => "Header5", };
my $table; $table = $mw->Scrolled('EMatrix', -cols => 5, -bd => 2, -bg => 'white', -titlerows => 1, -variable => $titleHash, );
$table->tagConfigure('title', -bg => 'tan', -fg => 'black', -relief => 'raised' );
$table->pack(-expand => 1, -fill => 'both');
The EMatrix widget is a derived widget that provides 6 additional methods above and beyond the traditional Tk::TableMatrix widget.
bindRow(-index = int, -sequence => string, -command => sub ref);>
bindRow binds a particular sequence to the subroutine at the row specified by the "-index" option. Note that binding row 0 will bind the column headers, which may not be what you want.
You cannot currently bind a range of rows (i.e. -index=>2-5) for now, though that is an enhancement I may add in the future.
e.g. $em->bindRow( -index => 2, -sequence => '<Control-g>', -command => sub{ print "Hello World!" } );
bindCol(-index = int, -sequence => string, -command => sub ref);>
This method is identical to 'bindRow()' above, except that it binds a column instead of a row (duh).
getRow(index, ?range?);
Returns the row at specified index as an array in list context, or an array reference in scalar context.
If the range is omitted (or 'end' is used), it will return the contents of all cells in that row (including empty cells). Otherwise, it will only return the contents of the cells up to the specified range, starting at index 0.
getRowHash(index, ?range?, ?tie?);
Returns the row at the specified index as a hash. The key is the cell value ('0,1' for example), the value is the content of the cell.
If a second index is omitted (or 'end' is used), it will return the contents of all cells in that row (including empty cells). Otherwise, it will only return the contents of the cells up to the specified range starting at index 0.
If the string 'tie' is included, the hash will be returned in cell order (left to right). To use this option you must have the Tie::IxHash module installed.
getCol(index, ?range?);
Returns the column at the specified index as an array in list context, or an array reference in scalar context. See 'getRow()' for more details.
getColHash(index, ?range?, ?tie?);
Returns the column at the specified index as a hash in list context, or a hash reference in scalar context. See 'getRowHash()' above for more details.
If the string 'tie' is included as an argument, the hash will be returned in cell order (top to bottom). This requires the Tie::IxHash module.
e.g. $dw->getRow(0, 3-5); # Would return the contents of cells 3, 4 and 5 at row 0.
Daniel Berger, djberg96@hotmail.com
Many thanks go out to John Cerney for providing help with this module (especially the bind methods).
Tk::TableMatrix, Tie::IxHash.
2 POD Errors
The following errors were encountered while parsing the POD:
'=item' outside of any '=over'
You forgot a '=back' before '=head1'
To install Tk::EMatrix, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Tk::EMatrix
CPAN shell
perl -MCPAN -e shell install Tk::EMatrix
For more information on module installation, please visit the detailed CPAN module installation guide.