I use two finger movement on my trackpad for scrolling a notebook page up and down. Is it possible to make a docked cells that scrolls to the left and right using a two finger movement on the trackpad?

The reason I ask is because sometimes my notebook window is not full screen. My notebook needs to be in full screen mode to see the entire docked cell. I have lots of buttons that can't be seen if it is not. I don't want to make the buttons smaller than they already are.

It would be nice to have a way to scroll to the right and left to reach the buttons without resizing the notebook window. Is this possible?

  • 1
    $\begingroup$ You could wrap the content with Pane with Scrollbars and it seem it partially works, can't use the bar itself but arrows at its ends are. Maybe a grid of buttons is a solution, or do you insist on having one? $\endgroup$ – Kuba Nov 27 '15 at 10:52
  • $\begingroup$ Thank you Kuba. I would like to be able to use two finger gesture instead of manually clicking the scrollbar. I would prefer if the scrollbar wasn't present at all. I could do as you suggested and create a grid instead of row, but was trying to avoid this as it would make my toolbar taller which cuts into my viewing area. $\endgroup$ – Michael McCain Nov 27 '15 at 10:58
  • 1
    $\begingroup$ Try GestureHandler with Alignment or a ScrollPosition, can't test now, no pad around ;) $\endgroup$ – Kuba Nov 27 '15 at 11:02
  • $\begingroup$ I will! Thanks again Kuba. If this works, I'll post my solution. $\endgroup$ – Michael McCain Nov 27 '15 at 11:15
  • $\begingroup$ It looks like the gesture handler is for touch devices only. It doesn't recognize the gestures on the trackpad on my mac. $\endgroup$ – Michael McCain Nov 27 '15 at 13:41

Using MMA 11.0.0 the following works to create a scrollable docked cell:

setScrollingDockedCell[expr_] :=
   DockedCells ->
        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:

   With[{i = i},
   {i, Range[100]}

   With[{i = i},
    PasteButton[Row@{i, j}, {i, j}]
   {i, Range[3]},
   {j, Range[100]}

    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:


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.

  • $\begingroup$ Works in 10.3 as well. $\endgroup$ – Michael McCain Nov 25 '16 at 2:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.