1TableMatrix::SpreadsheetHideRopwesr(l3/)Tk DocumenTtaabtlieoMnatrix::SpreadsheetHideRows(3)
2
3
4
6 Tk::TableMatrix::SpreadsheetHideRows - Table Display with selectable
7 hide/un-hide of rows
8
10 use Tk;
11 use Tk::TableMatrix::SpreadsheetHideRows
12
13 my $t = $top->Scrolled('SpreadsheetHideRows',
14 -selectorCol => 3,
15 -expandData => $hashRef,
16 -rows => 21, -cols => 11,
17 -width => 6, -height => 6,
18 -titlerows => 1, -titlecols => 1,
19 -variable => $arrayVar,
20 -selectmode => 'extended',
21 -resizeborders => 'both',
22 -bg => 'white',
23 );
24
26 Tk::TableMatrix::SpreadsheetHideRows is a
27 Tk::TableMatrix::Spreadsheet-derived widget that implements a
28 Spreadsheet-like display of tabular information, where some of the rows
29 in the table can be expanded/hidden by clicking a '+/-' selector in the
30 row. This can be used to display top-level information in a table,
31 while allowing the user to expand certain table rows to view detail-
32 level information.
33
34 See demos/SpreadsheetHideRows in the source distribution for a simple
35 example of this widget
36
38 In addition the standard Tk::TableMatrix widget options. The following
39 options are implemented:
40
41 -selectorCol
42 Column number where the +/- selector will appear. Clicking on the +/-
43 selector will expand/hide the detail information in the table for a
44 particular row.
45
46 -selectorColWidth
47 Width of the column used to display the +/- selector. Defaults to 2
48
49 -expandData
50 Hash ref defining the detail-level data displayed when a row is
51 expanded (by clicking the +/- selector). This hash ref should have the
52 following structure:
53
54 $expandData = {
55 row1 => { tag => 'detailDataTag',
56 data => $detailData,
57 spans=> $spanData,
58 expandData => $subLevelData
59 },
60 row2 => {
61 .
62 .
63 }
64
65 Where:
66 row1, row2, ... Row numbers that will be expandable.
67 tag => 'detailDataTag' Tag name that will be applied to the detail data.
68 (optional)
69 $detailData 2D Array of detail-data to be displayed when
70 the row is expanded.
71 e.g. [ [ r1c1, r1c2, r1c3 ],
72 [ r2c1, r2c2, r2,c3] ]
73 $spans 1D array of span information (optional) to be
74 used for display of the detail information.
75 e.g. [ col2 => "rows,cols", col4 => "rows,cols", ... ]
76
77 $subLevelData Optional Recursive expandData used to hold detail-data of detail-data.
78
80 The following items are stored as member data
81
82 defaultCursor
83 Name of the mouse cursor pointer that is used for normal (i.e. non-
84 title, non-indicator) cells in the widget. This is set to the value
85 of the $widget->cget(-cursor) option when the widget is created.
86
87 indRowCols
88 Hash ref of Row/Cols indexes where there are indicators stores. This
89 is a quick lookup hash built from _expandData.
90
91 _expandData
92 Internal version of the expandData hash. Any sub-detail data (i.e.
93 expand data that is at lower levels of expandData) that is visible is
94 placed at the top level of this hash, for keeping track of the visible
95 expandData.
96
98 In addition the standard Tk::TableMatrix widget method. The following
99 methods are implemented:
100
101 showDetail
102 Shows (i.e. expands the table) the detail data for a given row. This
103 method is called when a user clicks on an indicator that is not already
104 expanded.
105
106 Usage:
107
108 $widget->showDetail($row);
109
110 # Shows the detail data for row number $row
111
112 hideDetail
113 Hides the detail data for a given row. This method is called when a
114 user clicks on an indicator that is already expanded.
115
116 Usage:
117
118 $widget->hideDetail($row);
119
120 # Hides the detail data for row number $row
121
122
123
124Tk1.29 2023-07-21TableMatrix::SpreadsheetHideRows(3)