       Re: Freeze Panes in Grid Expression (addendum)

• To: mathgroup at smc.vnet.net
• Subject: [mg105134] Re: [mg105060] Freeze Panes in Grid Expression (addendum)
• From: Bob Hanlon <hanlonr at cox.net>
• Date: Sun, 22 Nov 2009 06:08:15 -0500 (EST)

```The following suppresses scroll bars that are not needed and uses VerticalSlider for scrolling rows (with direction reversed).

scrollMatrix[m_?MatrixQ, rows_Integer, columns_Integer] :=
Module[{maxR,
nC = Min[columns, Length[m[]]],
nR = Min[rows, Length[m]]},
maxR = Length[m] - nR + 2;
Manipulate[
Grid[
Drop[m[[1 ;; maxR + nR - r]], 2 ;; maxR - r + 1]
[[All, {1, Sequence @@ Range[c, c + nC - 2]}]],
Dividers -> {{False, True}, {False, True}}],
{{r, maxR}, 2, maxR, 1,
ControlType -> VerticalSlider},
{c, 2, Length[m[]] - nC + 2, 1},
ControlPlacement -> {Left, Top}]] /;
rows < Length[m] &&
columns < Length[m[]]

scrollMatrix[m_?MatrixQ, rows_Integer, columns_Integer] :=
Module[{maxR = Length[m] - rows + 2},
Manipulate[
Grid[
Drop[m[[1 ;; maxR + rows - r]], 2 ;; maxR - r + 1],
Dividers -> {None, {False, True}}],
{{r, maxR}, 2, maxR, 1,
ControlType -> VerticalSlider},
ControlPlacement -> Left]] /; rows < Length[m]

scrollMatrix[m_?MatrixQ, rows_Integer, columns_Integer] :=
Manipulate[
Grid[
m[[All, {1, Sequence @@ Range[c, c + columns - 2]}]],
Dividers -> {{False, True}, None}],
{c, 2, Length[m[]] - columns + 2, 1}] /; columns < Length[m[]]

scrollMatrix[m_?MatrixQ, rows_Integer, columns_Integer] :=
Grid[m]

m = Array[a, {3, 3}];

scrollMatrix[m, 6, 5]

m = Array[a, {15, 3}];

scrollMatrix[m, 6, 5]

m = Array[a, {3, 15}];

scrollMatrix[m, 6, 6]

m = Array[a, {15, 15}];

scrollMatrix[m, 6, 6]

Bob Hanlon

---- Bob Hanlon <hanlonr at cox.net> wrote:

=============

scrollMatrix[m_?MatrixQ, rows_Integer, columns_Integer] :=
Module[{
nC = Min[columns, Length[m[]]],
nR = Min[rows, Length[m]]},
Manipulate[
Grid[
Drop[m[[1 ;; r + nR - 2]], 2 ;; r - 1]
[[All, {1, Sequence @@ Range[c, c + nC - 2]}]],
Dividers -> {{False, True}, {False, True}}],
{r, 2, Length[m] - nR + 2, 1},
{c, 2, Length[m[]] - nC + 2, 1}]]

m = Array[a, {15, 10}];

scrollMatrix[m, 10, 5]

Bob Hanlon

---- Thomas Melehan <tpmelehan at me.com> wrote:

=============
Folks: I often generate a 2D matrix that I would love to be able to view in Mathematica as one does in say Excel, by freezing the window at a certain column and scrolling thru the rest of the columns to the right of the frozen column.  I can take the expression and dump it into Excel but it is somewhat time consuming.  Does anyone know how to directly achieve this in Mathematica, by say using two panels?

```

• Prev by Date: Re: Flat attribute and order of function definitions
• Next by Date: "If" syntax question
• Previous by thread: Re: Labelling a plot with maximum