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