| 1 |
|
| 2 |
=head1 NAME |
| 3 |
|
| 4 |
Tk::Table - Scrollable 2 dimensional table of Tk widgets |
| 5 |
|
| 6 |
=for pm Tk/Table.pm |
| 7 |
|
| 8 |
=for category Tk Geometry Management |
| 9 |
|
| 10 |
=head1 SYNOPSIS |
| 11 |
|
| 12 |
use Tk::Table; |
| 13 |
|
| 14 |
$table = $parent->Table(-rows => number, |
| 15 |
-columns => number, |
| 16 |
-scrollbars => anchor, |
| 17 |
-fixedrows => number, |
| 18 |
-fixedcolumns => number, |
| 19 |
-takefocus => boolean); |
| 20 |
|
| 21 |
$widget = $table->Button(...); |
| 22 |
|
| 23 |
$old = $table->put($row,$col,$widget); |
| 24 |
$old = $table->put($row,$col,"Text"); # simple Label |
| 25 |
$widget = $table->get($row,$col); |
| 26 |
|
| 27 |
$cols = $table->totalColumns; |
| 28 |
$rows = $table->totalRows; |
| 29 |
|
| 30 |
$table->see($widget); |
| 31 |
$table->see($row,$col); |
| 32 |
|
| 33 |
($row,$col) = $table->Posn($widget); |
| 34 |
|
| 35 |
=head1 DESCRIPTION |
| 36 |
|
| 37 |
Tk::Table is an all-perl widget/geometry manager which allows a two dimensional |
| 38 |
table of arbitary perl/Tk widgets to be displayed. |
| 39 |
|
| 40 |
Entries in the Table are simply ordinary perl/Tk widgets. They should |
| 41 |
be created with the Table as their parent. Widgets are positioned in the |
| 42 |
table using: |
| 43 |
|
| 44 |
$table->put($row,$col,$widget) |
| 45 |
|
| 46 |
If I<$widget> is not a reference it is treated as a string, and |
| 47 |
a Lable widget is created with the string as its text. |
| 48 |
|
| 49 |
All the widgets in each column are set to the same width - the requested |
| 50 |
width of the widest widget in the column. |
| 51 |
Likewise, all the widgets in each row are set to the same height - the requested |
| 52 |
height of the tallest widget in the column. |
| 53 |
|
| 54 |
A number of rows and/or columns can be marked as 'fixed' - and so can serve |
| 55 |
as 'headings' for the remainder the rows which are scrollable. |
| 56 |
|
| 57 |
The requested size of the table as a whole is such that the number of rows |
| 58 |
specified by -rows (default 10), and number of columns specified by -columns |
| 59 |
(default 10) can be displayed. |
| 60 |
|
| 61 |
If the Table is told it can take the keyboard focus then cursor and scroll |
| 62 |
keys scroll the displayed widgets. |
| 63 |
|
| 64 |
C<-scrollbars>. By default, scrollbars will be added C<nw>. |
| 65 |
To disable scrollbars, set C<-scrollbars> to an empty string: |
| 66 |
|
| 67 |
$table = $parent->Table(-scrollbars => '', ...); |
| 68 |
|
| 69 |
The table can be emptied using |
| 70 |
|
| 71 |
$table->clear |
| 72 |
|
| 73 |
the widgets which were in the table are destroyed. |
| 74 |
|
| 75 |
|
| 76 |
The Tk::Table widget is derived from a L<Tk::Frame>, so inherits all its |
| 77 |
configure options. |
| 78 |
|
| 79 |
The default focus traversal is giving the focus only to the table |
| 80 |
widget as a whole. To enable focus traversal into table cells (e.g. if |
| 81 |
there are embedded entry widgets), then the option C<-takefocus> has |
| 82 |
to be set to C<0>. |
| 83 |
|
| 84 |
=head1 BUGS / Snags / Possible enhancements |
| 85 |
|
| 86 |
=over 4 |
| 87 |
|
| 88 |
=item * |
| 89 |
|
| 90 |
Very large Tables consume a lot of X windows. |
| 91 |
|
| 92 |
=item * |
| 93 |
|
| 94 |
No equivalent of pack's -anchor/-pad etc. options |
| 95 |
|
| 96 |
=back |
| 97 |
|
| 98 |
=head1 SEE ALSO |
| 99 |
|
| 100 |
L<Tk::grid>, L<Tk::HList>, L<Tk::TableMatrix>, L<Tk::MListbox>, |
| 101 |
L<Tk::Columns> |
| 102 |
|
| 103 |
=cut |
| 104 |
|