1TableMatrix(3)        User Contributed Perl Documentation       TableMatrix(3)
2
3
4

NAME

6       TableMatrix - Create and manipulate tables
7

Synopsis

9       $table = $parent->TableMatrix(?options?);
10

STANDARD OPTIONS

12       -anchor  -background  -cursor
13          -exportselection  -font  -foreground    -highlightbackground
14       -highlightcolor
15        -highlightthickness    -insertbackground  -insertborderwidth
16       -insertofftime
17          -insertontime  -insertwidth  -invertselected  -relief  -takefocus
18        -xscrollcommand    -yscrollcommand
19

Widget-specific Options

21       Switch: -autoclear
22       Name: autoClear
23       Class: AutoClear
24        A boolean value which specifies whether the first keypress in a cell
25        will delete whatever text was previously there.  Defaults to 0.
26
27       Switch:  -bordercursor
28       Name: borderCursor
29       Class: Cursor
30        Specifies the name of the cursor to show when over borders, a visual
31        indication that interactive resizing is allowed (it is thus affect by
32        the value of -resizeborders).  Defaults to crosshair .
33
34       Switch: -borderwidth or -bd
35       Name: borderWidth
36       Class: BorderWidth
37        Specifies a non-negative pixel value or list of values indicating the
38        width of the 3-D border to draw on interior table cells (if such a
39        border is being drawn; the <Brelief> option typically determines
40        this).  If one value is specified, a rectangle of this width will be
41        drawn.  If two values are specified, then only the left and right
42        edges of the cell will have borders.  If four values are specified,
43        then the values correspond to the {left right top bottom} edges.  This
44        can be overridden by the a tag's borderwidth option.  It can also be
45        affected by the defined -drawmode for the table.  Each value in the
46        list must have one of the forms acceptable to Tk_GetPixels.
47
48       Switch: -browsecommand or -browsecmd
49       Name: browseCommand
50       Class: BrowseCommand
51        Specifies a command (callback) which will be evaluated anytime the
52        active cell changes. The Previous Index and the Current index is
53        passed to this command as arguments.
54
55       Switch: -cache
56       Name: cache
57       Class: Cache
58        A boolean value that specifies whether an internal cache of the table
59        contents should be kept.  This greatly enhances speed performance when
60        used with -command  but uses extra memory.  Can maintain state when
61        both -command  and -variable  are empty.  The cache is automatically
62        flushed whenever the value of -cache  or -variable  changes, otherwise
63        you have to explicitly call clear on it.  Defaults to off.
64
65       Switch: -colorigin
66       Name: colOrigin
67       Class: Origin
68        Specifies what column index to interpret as the leftmost column in the
69        table. This value is used for user indices in the table.  Defaults to
70        0.
71
72       Switch: -cols
73       Name: cols
74       Class: Cols
75        Number of cols in the table.  Defaults to 10.
76
77       Switch: -colseparator
78       Name: colSeparator
79       Class: Separator
80        Specifies a separator character that will be interpreted as the column
81        separator when cutting or pasting data in a table.  By default,
82        columns are separated as elements of a tcl list.
83
84       Switch: -colstretchmode
85       Name: colStretchMode
86       Class: StretchMode
87        Specifies one of the following stretch modes for columns to fill extra
88        allocated window space:
89
90       none
91         Columns will not stretch to fill the assigned window space.  If the
92         columns are too narrow, there will be a blank space at the right of
93         the table.  This is the default.
94
95       unset
96         Only columns that do not have a specific width set will be stretched.
97
98       all
99         All columns will be stretched by the same number of pixels to fill
100         the window space allocated to the table.  This mode can interfere
101         with interactive border resizing which tries to force column width.
102
103       last
104         The last column will be stretched to fill the window space allocated
105         to the table.
106
107       fill
108         (only valid for -rowstretch  currently)
109
110         The table will get more or less columns according to the window space
111         allocated to the table.  This mode has numerous quirks and may
112         disappear in the future.
113
114       Switch: -coltagcommand
115       Name: colTagCommand
116       Class: TagCommand
117        Provides the name of a procedure that will be evaluated by the widget
118        to determine the tag to be used for a given column.  When displaying a
119        cell, the table widget will first check to see if a tag has been
120        defined using the tag col  widget method.  If no tag is found, it will
121        evaluate the named procedure passing the column number in question as
122        the sole argument.  The procedure is expected to return the name of a
123        tag to use, or a null string. Errors occuring during the evaluation of
124        the procedure, or the return of an invalid tag name are silently
125        ignored.
126
127        The Current column number is passed as an argument to the col command.
128
129       Switch: -colwidth
130       Name: colWidth
131       Class: ColWidth
132        Default column width, interpreted as characters in the default font
133        when the number is positive, or pixels if it is negative.  Defaults to
134        10.
135
136       Switch: -command
137       Name: command
138       Class: Command
139        Specified a command to use as a procedural interface to cell values.
140        If -usecommand  is true, this command will be used instead of any
141        reference to the -variable  array.  When retrieving cell values, the
142        return value of the command is used as the value for the cell.
143
144        Args passed to this callback: The Set Flag (=1 if setting, else
145        retrieving), the current row, the current col, the cell value (if
146        setting).
147
148       Switch: -drawmode
149       Name: drawMode
150       Class: DrawMode
151        Sets the table drawing mode to one of the following options:
152
153       slow
154         The table is drawn to an offscreen pixmap using the Tk bordering
155         functions (double-buffering).  This means there will be no flashing,
156         but this mode is slow for larger tables.
157
158       compatible
159         The table is drawn directly to the screen using the Tk border
160         functions. It is faster, but the screen may flash on update.  This is
161         the default.
162
163       fast
164         The table is drawn directly to the screen and the borders are done
165         with fast X calls, so they are always one pixel wide only.  As a side
166         effect, it restricts -borderwidth  to a range of 0 or 1.  This mode
167         provides best performance for large tables, but can flash on redraw
168         and is not 100% Tk compatible on the border mode.
169
170       single
171         The table is drawn to the screen as in fast mode, but only single
172         pixel lines are drawn (not square borders).
173
174       Switch: -flashmode
175       Name: flashMode
176       Class: FlashMode
177        A boolean value which specifies whether cells should flash when their
178        value changes.  The table tag flash  will be applied to these cells
179        for the duration specified by -flashtime .  Defaults to 0.
180
181       Switch: -flashtime
182       Name: flashTime
183       Class: FlashTime
184        The amount of time, in 1/4 second increments, for which a cell should
185        flash when its value has changed.  -flashmode  must be on.  Defaults
186        to 2.
187
188       Switch: -height
189       Name: height
190       Class: Height
191        Specifies the desired height for the window, in rows. If zero or less,
192        then the desired height for the window is made just large enough to
193        hold all the rows in the table.  The height can be further limited by
194        -maxheight .
195
196       Switch: -invertselected
197       Name: invertSelected
198       Class: InvertSelected
199        Specifies whether the foreground and background of an item should
200        simply have their values swapped instead of merging the sel  tag
201        options when the cell is selected.  Defaults to 0 (merge sel tag).
202
203       Switch: -ipadx
204       Name: ipadX
205       Class: Pad
206        A pixel value specifying the internal offset X padding for text in a
207        cell.  This value does not grow the size of the cell, it just causes
208        the text to be drawn further from the cell border.  It only affects
209        one side (depending on anchor).  Defaults to 0.  See -padx for an
210        alternate padding style.
211
212       Switch: -ipady
213       Name: ipadY
214       Class: Pad
215        A pixel value specifying the internal offset Y padding for text in a
216        cell.  This value does not grow the size of the cell, it just causes
217        the text to be drawn further from the cell border.  It only affects
218        one side (depending on anchor).  Defaults to 0.  See -pady for an
219        alternate padding style.
220
221       Switch: -justify
222       Name: justify
223       Class: Justify
224        How to justify multi-line text in a cell. It must be one of left,
225        right, or center. Defaults to left.
226
227       Switch: -maxheight
228       Name: maxHeight
229       Class: MaxHeight
230        The max height in pixels that the window will request.  Defaults to
231        600.
232
233       Switch: -maxwidth
234       Name: maxWidth
235       Class: MaxWidth
236        The max width in pixels that the window will request.  Defaults to
237        800.
238
239       Switch: -multiline
240       Name: multiline
241       Class: Multiline
242        Specifies the default setting for the multiline tag option.  Defaults
243        to 1.
244
245       Switch: -pady
246       Name: padX
247       Class: Pad
248        A pixel value specifying the offset X padding for a cell.  This value
249        causes the default size of the cell to increase by two times the value
250        (one for each side), unless a specific pixel size is chosen for the
251        cell with the width command.  This will force an empty area on the
252        left and right of each cell edge.  This padding affects all types of
253        data in the cell.  Defaults to 0.  See -ipadx for an alternate padding
254        style.
255
256       Switch: -pady
257       Name: padY
258       Class: Pad
259        A pixel value specifying the offset Y padding for a cell.  This value
260        causes the default size of the cell to increase by two times the value
261        (one for each side), unless a specific pixel size is chosen for the
262        cell with the height command.  This will force an empty area on the
263        top and bottom of each cell edge.  This padding affects all types of
264        data in the cell.  Defaults to 0.  See -ipadx for an alternate padding
265        style.
266
267       Switch: -resizeborders
268       Name: resizeBorders
269       Class: ResizeBorders
270        Specifies what kind of interactive border resizing to allow, must be
271        one of row, col, both (default) or none.
272
273       Switch: -rowheight
274       Name: rowHeight
275       Class:
276        RowHeight  Default row height, interpreted as lines in the default
277        font when the number is positive, or pixels if it is negative.
278        Defaults to 1.
279
280       Switch: -roworigin
281       Name: rowOrigin
282       Class: Origin
283        Specifies what row index to interpret as the topmost row in the table.
284        This value is used for user indices in the table.  Defaults to 0.
285
286       Switch: -rows
287       Name: rows
288       Class: Rows
289        Number of rows in the table.  Defaults to 10.
290
291       Switch: -rowseparator
292       Name: rowSeparator
293       Class: Separator
294        Specifies a separator character that will be interpreted as the row
295        separator when cutting or pasting data in a table.  By default, rows
296        are separated as tcl lists.
297
298       Switch: -rowstretchmode
299       Name: rowStretchMode
300       Class: StretchMode
301        Specifies the stretch modes for rows to fill extra allocated window
302        space.  See -colstretchmode  for valid options.
303
304       Switch: -rowtagcommand
305       Name: rowTagCommand
306       Class: TagCommand
307        Provides the name of a procedure that can evaluated by the widget to
308        determine the tag to be used for a given row.  The procedure must be
309        defined by the user to accept a single argument (the row number), and
310        return a tag name or null string.  This operates in a similar manner
311        as -coltagcommand , except that it applies to row tags.
312
313        The Current row number is passed as an argument to the row command.
314
315       Switch: -selectioncommand or -selcmd
316       Name: selectionCommand
317       Class: SelectionCommand
318        Specifies a command (callback) to evaluate when the selection is
319        retrieved from a table via the selection mechanism (ie: evaluating
320        "selection get "). The return value from this command will become the
321        string passed on by the selection mechanism.  The following arguments
322        are passed to this callback: The number of rows in the selection,
323        number of columns in the selection, the selection string, the number
324        of cell in the selection.
325
326       Switch: -selectmode
327       Name: selectMode
328       Class: SelectMode
329        Specifies one of several styles for manipulating the selection.  The
330        value of the option may be arbitrary, but the default bindings expect
331        it to be either single , browse , multiple , or extended ; the default
332        value is browse .  These styles are like those for the Tk listbox,
333        except expanded for 2 dimensions.
334
335       Switch: -selecttitle
336       Name: selectTitles
337       Class: SelectTitles
338        Specifies whether title cells should be allowed in the selection.
339        Defaults to 0 (disallowed).
340
341       Switch: -selecttype
342       Name: selectType
343       Class: SelectType
344        Specifies one of several types of selection for the table.  The value
345        of the option may be one of row , col , cell , or both  (meaning row
346        && col ); the default value is cell .  These types define whether an
347        entire row/col is affected when a cell's selection is changed (set or
348        clear).
349
350       Switch: -sparsearray
351       Name: sparseArray
352       Class: SparseArray
353        A boolean value that specifies whether an associated Tcl array should
354        be kept as a sparse array (1, the default) or as a full array (0).  If
355        true, then cell values that are empty will be deleted from the array
356        (taking less memory).  If false, then all values in the array will be
357        maintained.
358
359       Switch: -state
360       Name: state
361       Class: State
362        Specifies one of two states for the entry:  normal  or disabled.  If
363        the table is disabled then the value may not be changed using widget
364        commands and no insertion cursor will be displayed, even if the input
365        focus is in the widget.  Also, all insert or delete methods will be
366        ignored.  Defaults to normal .
367
368       Switch: -titlecols
369       Name: titleCols
370       Class: TitleCols
371        Number of columns to use as a title area.  Defaults to 0.
372
373       Switch: -titlerows
374       Name: titleRows
375       Class: TitleRows
376        Number of rows to use as a title area.  Defaults to 0.
377
378       Switch: -usecommand
379       Name: useCommand
380       Class: UseCommand
381        A boolean value which specifies whether to use the command  option.
382        This value sets itself to zero if command  is used and returns an
383        error. Defaults to 1 (will use command  if specified).
384
385       Switch: -validate
386       Name: validate
387       Class: Validate
388        A boolean specifying whether validation should occur for the active
389        buffer. Defaults to 0.
390
391       Switch: -validatecommand or -vcmd
392       Name: validateCommand
393       Class: ValidateCommand
394        Specifies a command (callback) to execute when the active cell is
395        edited.  This command is expected to return a 1 or 0.  If it returns
396        1, then it is assumed the new value is OK, otherwise the new value is
397        rejected (the edition will not take place).  Errors in this command
398        are handled in the background. The following arguments are supplied to
399        the callback: row, col, oldContents of cell, potential new contents of
400        cell, Current Index in the cell.
401
402       Switch: -variable
403       Name: variable
404       Class: Variable
405        Global Tcl array variable to attach to the table's C array.  It will
406        be created if it doesn't already exist or is a simple variable.  Keys
407        used by the table in the array are of the form row ,col  for cells and
408        the special key active  which contains the value of the active cell
409        buffer.  The Tcl array is managed as a sparse array (the table doesn't
410        require all valid indices have values).  No stored value for an index
411        is equivalent to the empty string, and clearing a cell will remove
412        that index from the Tcl array, unless the -sparsearray  options is set
413        to 0.
414
415       Switch: -width
416       Name: width
417       Class: Width
418        Specifies the desired width for the window, in columns. If zero or
419        less, then the desired width for the window is made just large enough
420        to hold all the columns in the table.  The width can be further
421        limited by -maxwidth .
422
423       Switch: -wrap
424       Name: wrap
425       Class: Wrap
426        Specifies the default wrap value for tags.  Defaults to 0.
427

DESCRIPTION

429       The TableMatrix  command creates a 2-dimensional grid of cells.  The
430       table can use a Tcl array variable or Tcl command for data storage and
431       retrieval.  The widget has an active cell, the contents of which can be
432       edited (when the state is normal).  The widget supports a default style
433       for the cells and also multiple tags , which can be used to change the
434       style of a row, column or cell (see TAGS for details).  A cell flash
435       can be set up so that changed cells will change color for a specified
436       amount of time ("blink").
437        Cells can have embedded images or windows, as described in Tags and
438       "Embedded Windows" respectively.
439
440       One or more cells may be selected as described below.
441        If a table is exporting its selection (see -exportselection  option),
442       then it will observe the standard X11 protocols for handling the
443       selection.
444        See "the Selection" for details. It is not necessary for all the cells
445       to be displayed in the table window at once; commands described below
446       may be used to change the view in the window. Tables allow scrolling in
447       both directions using the standard -xscrollcommand  and -yscrollcommand
448       options.
449        They also support scanning, as described below.
450
451       In order to obtain good performance, the table widget supports multiple
452       drawing modes, two of which are fully Tk compatible.
453

Indices

455       Many of the widget commands for tables take one or more indices as
456       arguments. An index specifies a particular cell of the table, in any of
457       the following ways:
458
459       number,number
460        Specifies the cell as a numerical index of row,col which corresponds
461        to the index of the associated Perl Hash, where -roworigin,-colorigin
462        corresponds to the first cell in the table (0,0 by default). The
463        values for row and column will be constrained to actual values in the
464        table, which means a valid cell is always found.
465
466       active
467        Indicates the cell that has the location cursor. It is specified with
468        the activate  widget command.
469
470       anchor
471        Indicates the anchor point for the selection, which is set with the
472        selection anchor  widget command.
473
474       bottomright
475        Indicates the bottom-rightmost cell visible in the table.
476
477       end
478        Indicates the bottom right cell of the table.
479
480       origin
481        Indicates the top-leftmost editable cell of the table, not necessarily
482        in the display.  This takes into account the user specified origin and
483        title area.
484
485       topleft
486        Indicates the top-leftmost editable cell visible in the table (this
487        excludes title cells).
488
489       @x,y
490        Indicates the cell that covers the point in the table window specified
491        by x  and y (in pixel coordinates).  If no cell covers that point,
492        then the closest cell to that point is used. In the widget command
493        descriptions below, arguments named index , first , and last  always
494        contain text indices in one of the above forms.
495

Tags

497       A tag is a textual string that is associated with zero or more rows,
498       columns or cells in a table.  Tags may contain arbitrary characters,
499       but it is probably best to avoid using names which look like indices to
500       reduce coding confusion.  There may be any number of tags in a table,
501       but each row, column or cell can only have one tag associated with it
502       at a time.  There are several permanent tags in each table that can be
503       configured by the user and will determine the attributes for special
504       cells:
505
506       active
507        This tag is given to the active  cell
508
509       flash
510        If flash mode is on, this tag is given to any recently edited cells.
511
512       sel
513        This tag is given to any selected cells.
514
515       title
516        This tag is given to any cells in the title rows and columns.  This
517        tag has -state  disabled  by default.
518
519       Tags control the way cells are displayed on the screen.  Where
520       appropriate, the default for displaying cells is determined by the
521       options for the table widget.  However, display options may be
522       associated with individual tags using the tagConfigure method.  If a
523       cell, row or column has been tagged, then the display options
524       associated with the tag override the default display style.  The
525       following options are currently supported for tags:
526
527       -anchor anchor
528        Anchor for item in the cell space.
529
530       -background  or -bg  color
531        Background color of the cell.
532
533       -borderwidth  or -bd  pixel
534        Borderwidth of the cell, of the same format for the table, but may
535        also be empty to inherit the default table borderwidth value (the
536        default).
537
538       -font fontName
539        Font for text in the cell.
540
541       -foreground or -fg  color
542        Foreground color of the cell.
543
544       -justify justify
545        How to justify multi-line text in a cell. It must be one of left ,
546        right , or center.
547
548       -image imageName
549        An image to display in the cell instead of text.
550
551       -multiline boolean
552        Whether to display text with newlines on multiple lines.
553
554       -relief
555        The relief for the cell. May be the empty string to cause this tag to
556        not disturb the value.
557
558       -showtext boolean
559        Whether to show the text over an image.
560
561       -state state
562        The state of the cell, to allow for certain cells to be disabled. This
563        prevents the cell from being edited by the insert  or delete  methods,
564        but a direct set  will not be prevented.
565
566       -wrap boolean
567        Whether characters should wrap in a cell that is not wide enough.
568
569       A priority order is defined among tags based on creation order (first
570       created tag has highest default priority), and this order is used in
571       implementing some of the tag-related functions described below.  When a
572       cell is displayed, its properties are determined by the tags which are
573       assigned to it.  The priority of a tag can be modified by the tagLower
574       and the tagRaise methods.
575
576       If a cell has several tags associated with it that define the same
577       display options (eg - a title cell with specific row and cell tags),
578       then the options of the highest priority tag are used.  If a particular
579       display option hasn't been specified for a particular tag, or if it is
580       specified as an empty string, then that option will not be used; the
581       next-highest-priority tag's option will be used instead.  If no tag
582       specifies a particular display option, then the default style for the
583       widget will be used.
584
585       Images are used for display purposes only.  Editing in that cell will
586       still be enabled and any querying of the cell will show the text value
587       of the cell, regardless of the value of -showtext .
588
589       Note: There can be only one tag for a given tag type. ( Tag types =
590       flash , active , sel , title , celltag rowtag , coltag .) For example,
591       you can't apply two cell tags to a single cell (or two row tags to a
592       single row, etc) and expect the tag's properties to be merged. The last
593       tag-type applied will be the one that is used.
594

Embedded Windows

596       There may be any number of embedded windows in a table widget (one per
597       cell), and any widget may be used as an embedded window (subject to the
598       usual rules for geometry management, which require the table window to
599       be the parent of the embedded window or a descendant of its parent).
600       The embedded window's position on the screen will be updated as the
601       table is modified or scrolled, and it will be mapped and unmapped as it
602       moves into and out of the visible area of the table widget.  Each
603       embedded window occupies one cell's worth of space in the table widget,
604       and it is referred to by the index of the cell in the table.  Windows
605       associated with the table widget are destroyed when the table widget is
606       destroyed.
607
608       Windows are used for display purposes only.  A value still exists for
609       that cell, but will not be shown unless the window is deleted in some
610       way.  If the window is destroyed or lost by the table widget to another
611       geometry manager, then any data associated with it is lost (the cell it
612       occupied will no longer appear in window names ).
613
614       When an embedded window is added to a table widget with the window
615       configure widget command, several configuration options may be
616       associated with it.  These options may be modified with later calls to
617       the window configure widget command.  The following options are
618       currently supported:
619
620       -create callback
621        NOT CURRENTLY SUPPORTED.  Specifies a Tcl script that may be evaluated
622        to create the window for the annotation.
623         If no -window option has been specified for this cell then this
624        script will be evaluated when the cell is about to be displayed on the
625        screen.
626         Script must create a window for the cell and return the name of that
627        window as its result. If the cell's window should ever be deleted, the
628        script will be evaluated again the next time the cell is displayed.
629
630       -background or -bg color
631        Background color of the cell.  If not specified, it uses the table's
632        default background.
633
634       -borderwidth or -bd pixelList
635        Borderwidth of the cell, of the same format for the table, but may
636        also be empty to inherit the default table borderwidth value (the
637        default).
638
639       -padx pixels
640        As defined in the Tk options man page.
641
642       -pady pixels
643        As defined in the Tk options man page.
644
645       -relief relief
646        The relief to use for the cell in which the window lies.  If not
647        specified, it uses the table's default relief.
648
649       -sticky sticky
650        Stickiness of the window inside the cell, as defined by the grid
651        command.
652
653       -window $widget
654        Specifies the a window to display in the  annotation.  It must exist
655        before being specified here.
656

the Selection

658       Table selections are available as type STRING.  By default, the value
659       of the selection will be the values of the selected cells in nested Tcl
660       list form where each row is a list and each column is an element of a
661       row list. You can change the way this value is interpreted by setting
662       the -rowseparator  and -colseparator  options.
663        For example, default Excel format would be to set -rowseparator  to
664       "\n" and -colseparator  to "\t".  Changing these values affects both
665       how the table sends out the selection and reads in pasted data,
666       ensuring that the table should always be able to cut and paste to
667       itself.  It is possible to change how pastes are handled by editing the
668       table library procedure tk_tablePasteHandler .  This might be necessary
669       if -selectioncommand  is set.
670

Row/Col Spanning

672       Individual cells can span multiple rows and/or columns.  This is done
673       via the spans  command (see below for exact arguments).  Cells in the
674       title area that span are not permitted to span beyond the title area,
675       and will be constrained accordingly.  If the title area shrinks during
676       a configure, sanity checking will occur to ensure the above.  You may
677       set spans on regular cells that extend beyond the defined row/col area.
678       These spans will not be constrained, so that when the defined row/col
679       area expands, the span will expand with it.
680
681       When setting a span, checks are made as to whether the span would
682       overlap an already spanning or hidden cell.  This is an error and it
683       not allowed. Spans can affect the overall speed of table drawing,
684       although not significantly.  If spans are not used, then there is no
685       performance loss.
686
687       Cells hidden  by spanning cells still have valid data.  This will be
688       seen during cut and paste operations that involve hidden cells, or
689       through direct access by a command like get  or set .
690
691       The drawing properties of spanning cells apply to only the visual area
692       of the cell.  For example, if a cell is center justified over 5
693       columns, then when viewing any portion of those columns, it will appear
694       centered in the visible area. The non-visible column area will not be
695       considered in the centering calculations.
696

Command Substitution

698       The various option based commands that the table supports all support
699       the familiar Tk %-substitution model (see "Tk::bind " for more
700       details).
701        The following %-sequences are recognized and substituted by the table
702       widget:
703
704       %c
705        For SelectionCommand , it is the maximum number of columns in any row
706        in the selection.  Otherwise it is the column of the triggered cell.
707
708       %C
709        A convenience substitution for %r ,%c .
710
711       %i
712        For SelectionCommand, it is the total number of cells in the
713        selection. For Command , it is 0 for a read (get) and 1 for a write
714        (set). Otherwise it is the current cursor position in the cell.
715
716       %r
717        For SelectionCommand , it is the number of rows in the selection.
718        Otherwise it is the row of the triggered cell.
719
720       %s
721        For ValidateCommand , it is the current value of the cell being
722        validated.  For SelectionCommand , it is the default value of the
723        selection. For BrowseCommand , it is the index of the last active
724        cell. For Command , it is empty for reads (get) and the current value
725        of the cell for writes (set).
726
727       %S
728        For ValidateCommand , it is the potential new value of the cell being
729        validated.  For BrowseCommand , it is the index of the new active
730        cell.
731
732       %W
733        The pathname to the window for which the command was generated.
734

Widget Methods

736       The $window->TableMatrix  method creates a widget object. This object
737       supports the configure and cget methods described in Tk::options which
738       can be used to enquire and modify the options described above.  The
739       widget also inherits all the methods provided by the generic Tk::Widget
740       class.
741
742       The following additional methods are available for scale widgets:
743
744       $table->activate(index)
745        Sets the active cell to the one indicated by index.
746
747       $table->bbox(first, ?last?)
748        It returns the bounding box for the specified cell (range) as a
749        4-tuple of x, y, width and height in pixels.  It clips the box to the
750        visible portion, if any, otherwise an empty string is returned.
751
752       $table->border(option, args)
753        This command is a voodoo hack to implement border sizing for tables.
754        This is normally called through bindings, with the following as valid
755        options:
756
757       $table->borderMark(x, y, ?row|col?)
758         Records x  and y  and the row and/or column border under that point
759         in the table window, if any; used in conjunction with later border
760         dragto  commands.  Typically this command is associated with a mouse
761         button press in the widget.  If row  or col  is not specified, it
762         returns a tuple of both border indices (an empty item means no
763         border). Otherwise, just the specified item is returned.
764
765       $table->borderDragto(x, y)
766         This command computes the difference between its x  and y  arguments
767         and the x  and y  arguments to the last border mark  command for the
768         widget.  It then adjusts the previously marked border by the
769         difference.  This command is typically associated with mouse motion
770         events in the widget, to produce the effect of interactive border
771         resizing.
772
773       $table->cget(option)
774        Returns the current value of the configuration option given by option
775        .  Option  may have any of the values accepted by the table  command.
776
777       $table->clear(option, ?first?, ?last?)
778        This command is a convenience routine to clear certain state
779        information managed by the table.  first  and last  represent valid
780        table indices.  If neither are specified, then the command operates on
781        the whole table.  The following options are recognized:
782
783       $table->clearCache(?first?, ?last?)
784         Clears the specified section of the cache, if the table has been
785         keeping one.
786
787       $table->clearSizes(?first?, ?last?)
788         Clears the specified row and column areas of specific height/width
789         dimensions.  When just one index is specified, for example 2,0 , that
790         is interpreted as row 2 and  column 0.
791
792       $table->clearTags(?first?, ?last?)
793         Clears the specified area of tags (all row, column and cell tags).
794
795       $table->clearAll(?first?, ?last?)
796         Performs all of the above clear functions on the specified area.
797
798       $table->colWidth(?col?, ?value, col, value, ...?)
799        If no col  is specified, returns a list describing all cols for which
800        a width has been set.  If col  is specified with no value, it prints
801        out the width of that col in characters (positive number) or pixels
802        (negative number).  If one or more col-value  pairs are specified,
803        then it sets each col to be that width in characters (positive number)
804        or pixels (negative number).  If value  is default , then the col uses
805        the default width, specified by -colwidth .
806
807        $table->configure(?option?, ?value, option, value, ...?)
808         Query or modify the configuration options of the widget. If no option
809         is specified, returns a list describing all of the available options
810         for pathName  (see Tk_ConfigureInfo  for information on the format of
811         this list).  If option  is specified with no value , then the command
812         returns a list describing the one named option (this list will be
813         identical to the corresponding sublist of the value returned if no
814         option  is specified).  If one or more option-value  pairs are
815         specified, then the command modifies the given widget option(s) to
816         have the given value(s);  in this case the command returns an empty
817         string. Option  may have any of the values accepted by the table
818         command.
819
820        $table->curselection(?value?)
821         With no arguments, it returns the sorted indices of the currently
822         selected cells.  Otherwise it sets all the selected cells to the
823         given value.  The set has no effect if there is no associated Tcl
824         array or the state is disabled.
825
826        $table->curvalue(?value?)
827         If no value is given, the value of the cell being edited (indexed by
828         active ) is returned, else it is set to the given value.
829
830        $table->delete(option, arg, ?arg?)
831         This command is used to delete various things in a table.  It has
832         several forms, depending on the option :
833
834        $table->deleteActive(index, ?index?)
835          Deletes text from the active cell.  If only one index is given, it
836          deletes the character after that index, otherwise it deletes from
837          the first index to the second.  index  can be a number, insert  or
838          end .
839
840        $table->deleteCols(?switches?, index, ?count?)
841          Deletes count  cols starting at (and including) col index .  The
842          index  will be constrained to the limits of the tables.  If count
843          is negative, it deletes cols to the left.  Otherwise it deletes cols
844          to the right.  count  defaults to 1 (meaning just the column
845          specified).  The selection will be cleared.  At the moment, spans
846          are not adjusted with this action.  Optional switches are:
847
848        -holddimensions
849           Causes the table cols to be unaffected by the deletion (empty cols
850           may appear).
851            By default the dimensions are adjusted by count .
852
853        -holdtags
854           Causes the tags specified by the tag  method to not move along with
855           the data.  Also prevents specific widths set by the width  method
856           from being adjusted.
857            By default, these tags are properly adjusted.
858
859        -holdwindows
860           Causes the embedded windows created with the window  method to not
861           move along with the data.  By default, these windows are properly
862           adjusted.
863
864        -keeptitles
865           Prevents title area cells from being changed.  Otherwise they are
866           treated just like regular cells and will move as specified.
867
868        $table->deleteRows(?switches?, index, ?count?)
869          Deletes count  rows starting at (and including) row index .  If
870          count  is negative, it deletes rows going up.  Otherwise it deletes
871          rows going down.  The selection will be cleared.  The switches are
872          the same as those for column deletion.
873
874        $table->get(first, ?last?)
875         Returns the value of the cells specified by the table indices first
876         and (optionally) last  in a list.
877
878        $table->hidden(?index?, ?index, ...?)
879         When called without args, it returns all the hidden  cells (those
880         cells covered by a spanning cell).  If one index is specified, it
881         returns the spanning cell covering that index, if any.  If multiple
882         indices are specified, it returns 1 if all indices are hidden cells,
883         0 otherwise.
884
885        $table->icursor(?arg?)
886         With no arguments, prints out the location of the insertion cursor in
887         the active cell.  With one argument, sets the cursor to that point in
888         the string.  0 is before the first character, you can also use insert
889         or end  for the current insertion point or the end of the text.  If
890         there is no active cell, or the cell or table is disabled, this will
891         return -1.
892
893        $table->index(index, ?row|col?)
894         Returns the integer cell coordinate that corresponds to index  in the
895         form row,col.  If row  or col  is specified, then only the row or
896         column index is returned.
897
898        $table->insert(option, arg, arg)
899         This command is used to into various things into a table.  It has
900         several forms, depending on the option :
901
902        $table->insertActive(index, value)
903          The value  is a text string which is inserted at the index  postion
904          of the active cell.  The cursor is then positioned after the new
905          text. index  can be a number, insert  or end .
906
907        $table->insertCols(?switches?, index, ?count?)
908          Inserts count  cols starting at col index .  If count  is negative,
909          it inserts before the specified col.  Otherwise it inserts after the
910          specified col.  The selection will be cleared.  The switches are the
911          same as those for column deletion.
912
913        $table->insertRows(?switches?, index, ?count?)
914          Inserts count  rows starting at row index .  If count  is negative,
915          it inserts before the specified row.  Otherwise it inserts after the
916          specified row.  The selection will be cleared.  The switches are the
917          same as those for column deletion.
918
919        $table->reread()
920         Rereads the old contents of the cell back into the editing buffer.
921         Useful for a key binding when <Escape> is pressed to abort the edit
922         (a default binding).
923
924        $table->rowHeight(?row?, ?value, row, value, ...?)
925         If no row  is specified, returns a list describing all rows for which
926         a height has been set.  If row  is specified with no value, it prints
927         out the height of that row in characters (positive number) or pixels
928         (negative number).  If one or more row-value  pairs are specified,
929         then it sets each row to be that height in lines (positive number) or
930         pixels (negative number).  If value  is default , then the row uses
931         the default height, specified by -rowheight .
932
933        $table->scan(option, args)
934         This command is used to implement scanning on tables.  It has two
935         forms, depending on option :
936
937        $table->scanMark(x, y)
938          Records x  and y  and the current view in the table window;
939           used in conjunction with later scan dragto  commands. Typically
940          this command is associated with a mouse button press in the widget.
941          It returns an empty string.
942
943        $table->scanDragto(x, y.)
944          This command computes the difference between its x  and y  arguments
945          and the x  and y  arguments to the last scan mark  command for the
946          widget.  It then adjusts the view by 5 times the difference in
947          coordinates.  This command is typically associated with mouse motion
948          events in the widget, to produce the effect of dragging the list at
949          high speed through the window.  The return value is an empty string.
950
951        $table->see(index)
952         Adjust the view in the table so that the cell given by index  is
953         positioned as the cell one off from top left (excluding title rows
954         and columns) if the cell is not currently visible on the screen.  The
955         actual cell may be different to keep the screen full.
956
957        $table->selection(option, arg)
958         This command is used to adjust the selection within a table.
959          It has several forms, depending on option :
960
961        $table->selectionAnchor(index)
962          Sets the selection anchor to the cell given by index .  The
963          selection anchor is the end of the selection that is fixed while
964          dragging out a selection with the mouse.  The index anchor  may be
965          used to refer to the anchor cell.
966
967        $table->selectionClear(first?last?)
968          If any of the cells between first  and last  (inclusive) are
969          selected, they are deselected.
970           The selection state is not changed for cells outside this range.
971          first  may be specified as all  to remove the selection from all
972          cells.
973
974        $table->selectionIncludes(index)
975          Returns 1 if the cell indicated by index is currently selected, 0 if
976          it isn't.
977
978        $table->selectionSet(first, ?last?)
979          Selects all of the cells in the range between first  and last ,
980          inclusive, without affecting the selection state of cells outside
981          that range.
982
983         perltk note this needs to be perlized
984
985         $table->set(?row|col?, index, ?value?, ?index, value, ...?)
986
987         Sets the specified index to the associated value.  Table validation
988         will not be triggered via this method.  If row  or col  precedes the
989         list of index/value pairs, then the value is assumed to be a Tcl list
990         whose values will be split and set into the subsequent columns (if
991         row  is specified) or rows (for col ).  For example,  set row 2,3
992         {2,3 2,4 2,5}  will set 3 cells, from 2,3 to 2,5.  The setting of
993         cells is silently bounded by the known table dimensions.
994
995         $table->spans(?index?, ?rows,cols, index, rows,cols, ...?)
996
997         This command is used to manipulate row/col spans.  When called with
998         no arguments, all known spans are returned as a list of tuples of the
999         form {index span}.  When called with only the index , the span for
1000         that index  only is returned, if any.  Otherwise an even number of
1001         index rows,cols  pairs are used to set spans.  A span starts at the
1002         index  and continues for the specified number of rows and cols.
1003         Negative spans are not supported.  A span of 0,0 unsets any span on
1004         that cell.  See EXAMPLES for more info.
1005
1006         $table->tag(option, ?arg, arg, ...?)
1007
1008         This command is used to manipulate tags.  The exact behavior of the
1009         command depends on the option  argument that follows the tag
1010         argument. cget , cell , and row|col  complain about unknown tag
1011         names.  The following forms of the command are currently supported:
1012
1013        $table->tagCell(tagName, ?index, ...?)
1014          With no arguments, prints out the list of cells that use the tag.
1015          Otherwise it sets the specified cells to use the named tag,
1016          replacing any tag that may have been set using this method before.
1017          If tagName is '', the cells are reset to the default tag.  Tags
1018          added during -*tagcommand evaluation do not register here.  If
1019          tagName does not exist, it will be created with the default options.
1020
1021        $table->tagCget(tagName, option)
1022          This command returns the current value of the option named option
1023          associated with the tag given by tagName .  Option  may have any of
1024          the values accepted by the tag configure  widget command.
1025
1026        $table->tagCol(tagName, ?col, ...?)
1027          With no arguments, prints out the list of cols that use the tag.
1028          Otherwise it sets the specified columns to use the named tag,
1029          replacing any tag that may have been set using this method before.
1030          If <tagName> is '', the cols are reset to the default tag.  Tags
1031          added during -coltagcommand evaluation do not register here.  If
1032          tagName does not exist, it will be created with the default options.
1033
1034        $table->tagConfigure(tagName, ?option?, ?value?, ?option, value, ...?)
1035          This command is similar to the configure  widget command except that
1036          it modifies options associated with the tag given by tagName
1037          instead of modifying options for the overall table widget.  If no
1038          option  is specified, the command returns a list describing all of
1039          the available options for tagName  (see Tk_ConfigureInfo  for
1040          information on the format of this list).  If option  is specified
1041          with no value , then the command returns a list describing the one
1042          named option (this list will be identical to the corresponding
1043          sublist of the value returned if no option  is specified).  If one
1044          or more option-value  pairs are specified, then the command modifies
1045          the given option(s) to have the given value(s) in tagName ; in this
1046          case the command returns an empty string. See TAGS above for details
1047          on the options available for tags.
1048
1049        $table->tagDelete(tagName)
1050          Deletes a tag.  No error if the tag does not exist.
1051
1052        $table->tagExists(tagName)
1053          Returns 1 if the named tag exists, 0 otherwise.
1054
1055        $table->tagIncludes(tagName, index)
1056          Returns 1 if the specified index has the named tag, 0 otherwise.
1057
1058        $table->tagLower(tagName, ?belowThis?)
1059          Lower the priority of the named tag.  If belowThis is not specified,
1060          then the tag's priority is lowered to the bottom, otherwise it is
1061          lowered to one below belowThis.
1062
1063        $table->tagNames(?pattern?)
1064          If no pattern is specified, shows the names of all defined tags.
1065          Otherwise the pattern is used as a glob pattern to show only tags
1066          matching that pattern.  Tag names are returned in priority order
1067          (highest priority tag first).
1068
1069        $table->tagRaise(tagName, ?aboveThis?)
1070          Raise the priority of the named tag.  If aboveThis is not specified,
1071          then the tag's priority is raised to the top, otherwise it is raised
1072          to one above aboveThis.
1073
1074        $table->tagRow(tagName, ?row, ...?)
1075          With no arguments, prints out the list of rows that use the tag.
1076          Otherwise it sets the specified columns to use the named tag,
1077          replacing any tag that may have been set using this method before.
1078          If tagName is '', the rows are reset to use the default tag.  Tags
1079          added during -rowtagcommand evaluation do not register here.  If
1080          tagName does not exist, it will be created with the default options.
1081
1082        $table->validate(index)
1083         Explicitly validates the specified index based on the current
1084         -validatecommand  and returns 0 or 1 based on whether the cell was
1085         validated.
1086
1087        $table->window(option, ?arg, arg, ...?)
1088         This command is used to manipulate embedded windows.  The exact
1089         behavior of the command depends on the option  argument that follows
1090         the window  argument.  The following forms of the command are
1091         currently supported:
1092
1093        $table->windowCget(index, option)
1094          This command returns the current value of the option named option
1095          associated with the window given by index .  Option  may have any of
1096          the values accepted by the window configure  widget command.
1097
1098        $table->windowConfigure(index, ?option?, ?value?, ?option, value,
1099        ...?)
1100          This command is similar to the configure  widget command except that
1101          it modifies options associated with the embedded window given by
1102          index  instead of modifying options for the overall table widget.
1103          If no option  is specified, the command returns a list describing
1104          all of the available options for index  (see Tk_ConfigureInfo  for
1105          information on the format of this list).  If option  is specified
1106          with no value , then the command returns a list describing the one
1107          named option (this list will be identical to the corresponding
1108          sublist of the value returned if no option  is specified).  If one
1109          or more option-value  pairs are specified, then the command modifies
1110          the given option(s) to have the given value(s) in index ; in this
1111          case the command returns an empty string. See EMBEDDED WINDOWS above
1112          for details on the options available for windows.
1113
1114        $table->windowDelete(index, ?index, ...?)
1115          Deletes an embedded window from the table.  The associated window
1116          will also be deleted.
1117
1118        $table->windowMove(indexFrom, indexTo)
1119          Moves an embedded window from one cell to another.  If a window
1120          already exists in the target cell, it will be deleted.
1121
1122        $table->windowNames(?pattern?)
1123          If no pattern is specified, shows the cells of all embedded windows.
1124          Otherwise the pattern is used as a glob pattern to show only cells
1125          matching that pattern.
1126
1127        $table->xview(args)
1128         This command is used to query and change the horizontal position of
1129         the information in the widget's window.  It can take any of the
1130         following forms:
1131
1132        $table->xview()
1133         Returns a list containing two elements. Each element is a real
1134         fraction between 0 and 1;  together they describe the horizontal span
1135         that is visible in the window. For example, if the first element is
1136         .2 and the second element is .6, 20% of the table's text is off-
1137         screen to the left, the middle 40% is visible in the window, and 40%
1138         of the text is off-screen to the right. These are the same values
1139         passed to scrollbars via the -xscrollcommand  option.
1140
1141        $table->xview(index)
1142         Adjusts the view in the window so that the column given by index  is
1143         displayed at the left edge of the window.
1144
1145        $table->xviewMoveto(fraction)
1146         Adjusts the view in the window so that fraction  of the total width
1147         of the table text is off-screen to the left. fraction  must be a
1148         fraction between 0 and 1.
1149
1150        $table->xviewScroll(number, what)
1151         This command shifts the view in the window left or right according to
1152         number  and what . Number  must be an integer. What must be either
1153         units  or pages  or an abbreviation of one of these. If what  is
1154         units , the view adjusts left or right by number  cells on the
1155         display;  if it is pages  then the view adjusts by number
1156         screenfuls. If number  is negative then cells farther to the left
1157         become visible;  if it is positive then cells farther to the right
1158         become visible.
1159
1160        $table->yview(?args?)
1161         This command is used to query and change the vertical position of the
1162         text in the widget's window.  It can take any of the following forms:
1163
1164        $table->yview()
1165          Returns a list containing two elements, both of which are real
1166          fractions between 0 and 1.  The first element gives the position of
1167          the table element at the top of the window, relative to the table as
1168          a whole (0.5 means it is halfway through the table, for example).
1169          The second element gives the position of the table element just
1170          after the last one in the window, relative to the table as a whole.
1171          These are the same values passed to scrollbars via the
1172          -yscrollcommand  option.
1173
1174        $table->yview(index)
1175          Adjusts the view in the window so that the row given by index  is
1176          displayed at the top of the window.
1177
1178        $table->yviewMoveto(fraction)
1179          Adjusts the view in the window so that the element given by fraction
1180          appears at the top of the window. Fraction  is a fraction between 0
1181          and 1;  0 indicates the first element in the table, 0.33 indicates
1182          the element one-third the way through the table, and so on.
1183
1184        $table->yviewscroll(number, what)
1185          This command adjusts the view in the window up or down according to
1186          number  and what .  Number  must be an integer.  What  must be
1187          either units  or pages .  If what  is units , the view adjusts up or
1188          down by number  cells; if it is pages  then the view adjusts by
1189          number  screenfuls.  If number  is negative then earlier elements
1190          become visible; if it is positive then later elements become
1191          visible.
1192

Default Bindings

1194       The initialization creates class bindings that give the following
1195       default behaviour:
1196
1197       [1]
1198        Clicking Button-1 in a cell activates that cell.  Clicking into an
1199        already active cell moves the insertion cursor to the character
1200        nearest the mouse.
1201
1202       [2]
1203        Moving the mouse while Button-1 is pressed will stroke out a selection
1204        area. Exiting while Button-1 is pressed causing scanning to occur on
1205        the table along with selection.
1206
1207       [3]
1208        Moving the mouse while Button-2 is pressed causes scanning to occur
1209        without any selection.
1210
1211       [4]
1212        Home moves the table to have the origin in view.
1213
1214       [5]
1215        End moves the table to have the end  cell in view.
1216
1217       [6]
1218        Control-Home moves the table to the origin and activates that cell.
1219
1220       [7]
1221        Control-End moves the table to the end and activates that cell.
1222
1223       [8]
1224        Shift-Control-Home extends the selection to the origin.
1225
1226       [9]
1227        Shift-Control-End extends the selection to the end.
1228
1229       [10]
1230        The left, right, up and down arrows move the active cell.
1231
1232       [11]
1233        Shift-<arrow> extends the selection in that direction.
1234
1235       [12]
1236        Control-leftarrow and Control-rightarrow move the insertion cursor
1237        within the cell.
1238
1239       [13]
1240        Control-slash selects all the cells.
1241
1242       [14]
1243        Control-backslash clears selection from all the cells.
1244
1245       [15]
1246        Backspace deletes the character before the insertion cursor in the
1247        active cell.
1248
1249       [16]
1250        Delete deletes the character after the insertion cursor in the active
1251        cell.
1252
1253       [17]
1254        Escape rereads the value of the active cell from the specified data
1255        source, discarding any edits that have may been performed on the cell.
1256
1257       [18]
1258        Control-a moves the insertion cursor to the beginning of the active
1259        cell.
1260
1261       [19]
1262        Control-e moves the insertion cursor to the end of the active cell.
1263
1264       [20]
1265        Control-minus and Control-equals decrease and increase the width of
1266        the column with the active cell in it.
1267
1268       [21]
1269        Moving the mouse while Button-3 (the right button on Windows) is
1270        pressed while you are over a border will cause interactive resizing of
1271        that row and/or column to occur, based on the value of -resizeborders
1272        . Some bindings may have slightly different behavior dependent on the
1273        -selectionmode  of the widget. If the widget is disabled using the
1274        -state  option, then its view can still be adjusted and cells can
1275        still be selected, but no insertion cursor will be displayed and no
1276        cell modifications will take place. The behavior of tables can be
1277        changed by defining new bindings for individual widgets or by
1278        redefining the class bindings.  The default bindings are either
1279        compiled in the TableMatrix.pm file
1280

Performance Issues

1282       The number of rows and columns or a table widget should not
1283       significantly affect the speed of redraw.  Recalculation and redraw of
1284       table parameters and cells is restricted as much as possible. The
1285       display cell with the insert cursor is redrawn each time the cursor
1286       blinks, which causes a steady stream of graphics traffic.  Set the
1287       -insertofftime  option to 0 avoid this.  The use of a -command with the
1288       table without a cache can cause significant slow-down, as the command
1289       is called once for each request of a cell value.
1290

Examples

1292       Set the topleft title area to be one spanning cell.  This overestimates
1293       both row and column span by one, but the command does all the
1294       constraining for us.  $table span [$table cget -roworigin],[$table cget
1295       -colorigin] [$table cget -titlerows],[$table cget -titlecols]  Force a
1296       table window refresh (useful for the slight chance that a bug in the
1297       table is not causing proper refresh):  $table configure -padx [$table
1298       cget -padx]
1299

Keywords

1301       table, widget, extension
1302

POD ERRORS

1304       Hey! The above document had some coding errors, which are explained
1305       below:
1306
1307       Around line 938:
1308           L<> starts or ends with whitespace
1309
1310       Around line 1340:
1311           You can't have =items (as at line 1344) unless the first thing
1312           after the =over is an =item
1313
1314       Around line 1608:
1315           You forgot a '=back' before '=head1'
1316
1317
1318
1319perl v5.32.0                      2020-07-28                    TableMatrix(3)
Impressum