SYNOPSIS

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');


DESCRIPTION

The EMatrix widget is a derived widget that provides 6 additional methods above and beyond the traditional Tk::TableMatrix widget.


METHODS

bindRow(-index => int, -sequence => string, -command => sub ref);

The bindRow() method 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 in list context, or a hash reference in scalar context.  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 as an argument, 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.


FUTURE RELEASES

  1. Cell ranges - allow a range of cells to be selected at a particular index.

  2. e.g. $dw->getRow(0, 3-5); # Would return the contents of cells 3, 4 and 5 at row 0.
  3. A row of buttons on the left side to mimic MS Excel behavior.
  4. Methods to make importing Excel spreadsheets a snap (via the ParseExcel module perhaps).

AUTHOR

Daniel Berger, djberg96@hotmail.com

Many thanks go out to John Cerney for providing help with this module (especially the bind methods).


SEE ALSO

Tk::TableMatrix, Tie::IxHash.