| 1 |
/* |
| 2 |
* This is a port of the tcl/tk Tktable Widget version 2.8 to perl/tk |
| 3 |
*/ |
| 4 |
|
| 5 |
************************************* |
| 6 |
The Tk::TableMatrix Widget |
| 7 |
************************************* |
| 8 |
|
| 9 |
INTRODUCTION |
| 10 |
|
| 11 |
Tk::TableMatrix is a table/matrix widget extension to perl/tk |
| 12 |
for displaying data in a table (or spreadsheet) format. |
| 13 |
The basic features of the widget are: |
| 14 |
|
| 15 |
* multi-line cells |
| 16 |
* support for embedded windows (one per cell) |
| 17 |
* row & column spanning |
| 18 |
* variable width columns / height rows (interactively resizable) |
| 19 |
* row and column titles |
| 20 |
* multiple data sources ((perl hash|| perl callback) &| internal caching) |
| 21 |
* supports standard Tk reliefs, fonts, colors, etc. |
| 22 |
* x/y scrollbar support |
| 23 |
* 'tag' styles per row, column or cell to change visual appearance |
| 24 |
* in-cell editing - returns value back to data source |
| 25 |
* support for disabled (read-only) tables or cells (via tags) |
| 26 |
* multiple selection modes, with "active" cell |
| 27 |
* multiple drawing modes to get optimal performance for larger tables |
| 28 |
* optional 'flashes' when things update |
| 29 |
* cell validation support |
| 30 |
* Works everywhere Tk does (including Windows and Mac!) |
| 31 |
(Note perltk version has only been tested on Solaris, Linux, |
| 32 |
win98/NT/mingw32 as of 11/12/02) |
| 33 |
|
| 34 |
FINDING THE WIDGET |
| 35 |
|
| 36 |
The Section TBD |
| 37 |
|
| 38 |
|
| 39 |
BUILDING AND INSTALLING THE WIDGET |
| 40 |
|
| 41 |
1. Uncompress and unpack the distribution |
| 42 |
|
| 43 |
ON UNIX: |
| 44 |
gzip -d Tk-TableMatrix<version>.tar.gz |
| 45 |
tar -xf Tk-TableMatrix<version>.tar |
| 46 |
|
| 47 |
ON WINDOWS: |
| 48 |
use something like WinZip to unpack the archive. |
| 49 |
|
| 50 |
|
| 51 |
This will create a subdirectory TableMatrix<version> with all the files in it. |
| 52 |
|
| 53 |
2. Build/Test |
| 54 |
|
| 55 |
perl Makefile.PL |
| 56 |
make |
| 57 |
make test |
| 58 |
|
| 59 |
There are also some demos in the demo directory: |
| 60 |
perl -Mblib demos/TableMatrixTest |
| 61 |
perl -Mblib demos/spreadsheet |
| 62 |
. |
| 63 |
. |
| 64 |
etc. |
| 65 |
|
| 66 |
3. Install |
| 67 |
make install |
| 68 |
|
| 69 |
4. Read the documentation |
| 70 |
|
| 71 |
The tcl/tk html documentation has been translated to TableMatrix.pod. You can |
| 72 |
read it using the standard 'perldoc Tk::TableMatrix' command. |
| 73 |
|
| 74 |
THINGS TO WATCH OUT FOR |
| 75 |
|
| 76 |
Packing |
| 77 |
The table tries not to allocate huge chunks of screen real estate if |
| 78 |
you ask it for a lot of rows and columns. You can always stretch out |
| 79 |
the frame or explicitly tell it how big it can be. If you want to |
| 80 |
stretch the table, remember to pack it with fill both and expand on, |
| 81 |
or with grid, give it -sticky news and configure the grid row and column |
| 82 |
for some weighting. |
| 83 |
|
| 84 |
Array |
| 85 |
The array (actually a perl hash in the perltk implementation) elements |
| 86 |
for the table are of the form $array{"2,3"} etc. Make |
| 87 |
sure there are no spaces around the ','. Negative indices are allowed. |
| 88 |
|
| 89 |
Editing |
| 90 |
If you can't edit, remember that the focus model in tk is explicit, so |
| 91 |
you need to click on the table or give it the focus command. Just |
| 92 |
having a selected cell is not the same thing as being able to edit. |
| 93 |
You also need the editing cursor. If you can't get the cursor, make |
| 94 |
sure that you actually have a variable assigned to the table, and that |
| 95 |
the "state" of the cell is not disabled. |
| 96 |
|
| 97 |
COMMENTS, BUGS, etc. |
| 98 |
|
| 99 |
* Please can you send comments and bug reports to the current maintainer |
| 100 |
and their best will be done to address them. |
| 101 |
|
| 102 |
* If you find a bug, a short piece of Perl Code that exercises it would be very |
| 103 |
useful, or even better, compile with debugging and specify where it |
| 104 |
crashed in that short piece of Code. |