.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Table 3" .TH Table 3 2023-07-25 "perl v5.38.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Tk::Table \- Scrollable 2 dimensional table of Tk widgets .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& use Tk::Table; \& \& $table = $parent\->Table(\-rows => number, \& \-columns => number, \& \-scrollbars => anchor, \& \-fixedrows => number, \& \-fixedcolumns => number, \& \-takefocus => boolean); \& \& $widget = $table\->Button(...); \& \& $old = $table\->put($row,$col,$widget); \& $old = $table\->put($row,$col,"Text"); # simple Label \& $widget = $table\->get($row,$col); \& \& $cols = $table\->totalColumns; \& $rows = $table\->totalRows; \& \& $table\->see($widget); \& $table\->see($row,$col); \& \& ($row,$col) = $table\->Posn($widget); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" Tk::Table is an all-perl widget/geometry manager which allows a two dimensional table of arbitary perl/Tk widgets to be displayed. .PP Entries in the Table are simply ordinary perl/Tk widgets. They should be created with the Table as their parent. Widgets are positioned in the table using: .PP .Vb 1 \& $table\->put($row,$col,$widget) .Ve .PP If \fR\f(CI$widget\fR\fI\fR is not a reference it is treated as a string, and a Lable widget is created with the string as its text. .PP All the widgets in each column are set to the same width \- the requested width of the widest widget in the column. Likewise, all the widgets in each row are set to the same height \- the requested height of the tallest widget in the column. .PP A number of rows and/or columns can be marked as 'fixed' \- and so can serve as 'headings' for the remainder the rows which are scrollable. .PP The requested size of the table as a whole is such that the number of rows specified by \-rows (default 10), and number of columns specified by \-columns (default 10) can be displayed. .PP If the Table is told it can take the keyboard focus then cursor and scroll keys scroll the displayed widgets. .PP \&\f(CW\*(C`\-scrollbars\*(C'\fR. By default, scrollbars will be added \f(CW\*(C`nw\*(C'\fR. To disable scrollbars, set \f(CW\*(C`\-scrollbars\*(C'\fR to an empty string: .PP .Vb 1 \& $table = $parent\->Table(\-scrollbars => \*(Aq\*(Aq, ...); .Ve .PP The table can be emptied using .PP .Vb 1 \& $table\->clear .Ve .PP the widgets which were in the table are destroyed. .PP The Tk::Table widget is derived from a Tk::Frame, so inherits all its configure options. .PP The default focus traversal is giving the focus only to the table widget as a whole. To enable focus traversal into table cells (e.g. if there are embedded entry widgets), then the option \f(CW\*(C`\-takefocus\*(C'\fR has to be set to \f(CW0\fR. .SH "BUGS / Snags / Possible enhancements" .IX Header "BUGS / Snags / Possible enhancements" .IP \(bu 4 Very large Tables consume a lot of X windows. .IP \(bu 4 No equivalent of pack's \-anchor/\-pad etc. options .SH "SEE ALSO" .IX Header "SEE ALSO" Tk::grid, Tk::HList, Tk::TableMatrix, Tk::MListbox, Tk::Columns