Using MMA 11.0.0 the following works to create a scrollable docked cell:
setScrollingDockedCell[expr_] :=
SetOptions[EvaluationNotebook[],
DockedCells ->
Cell[BoxData@ToBoxes@
Pane[expr,
ImageSize -> Scaled[1]
]
]
];
Note that the ImageSize -> Scaled[1]
is crucial here. Without an explicit ImageSize
no scrolling occurs. Scaled[1] sticks the expression on a single line. Something ludicrous like ImageSize -> 100000000
will also work.
This works with all of the expressions I've tried:
setScrollingDockedCell@
Row@Table[
With[{i = i},
PasteButton[i]
],
{i, Range[100]}
]
setScrollingDockedCell@
Grid@Table[
With[{i = i},
PasteButton[Row@{i, j}, {i, j}]
],
{i, Range[3]},
{j, Range[100]}
]
setScrollingDockedCell@
Pane[Graphics[{
Disk[{0, 0}, 1000],
{White, Disk[{0, 0}, {100, 900}]},
{Green, Disk[{0, 0}, {75, 750}]},
{Black, Disk[{0, 0}, {50, 500}]},
Disk[{2000, 0}, 1000],
{White, Disk[{2000, 0}, {100, 900}]},
{Green, Disk[{2000, 0}, {75, 750}]},
{Black, Disk[{2000, 0}, {50, 500}]}
}, AspectRatio -> Full,
ImageSize -> 1000],
{Automatic, 25}]
All of those work
It seems to balk when there's a lot of blank space in the expression though:
setScrollingDockedCell@Range[1000]
That only starts scrolling when you have the cursor over one of the expression elements (a number/bracket/comma I mean)
Perhaps this is new as of 11 but I don't have a copy of 10 to test. It is very useful for things like tabbed windows though.
GestureHandler
withAlignment
or aScrollPosition
, can't test now, no pad around ;) $\endgroup$