10
$\begingroup$

I have made a handy toolbar that provides access to menu items that are not visible when I F12 a workbook.

enter image description here I would like to add the following function to a button in the toolbar:

magnification = 1.0;
SetOptions[SelectedNotebook[], 
Magnification :> Dynamic[magnification] ];
Slider[Dynamic[magnification], {0.8, 2, .01}]

which gives me a Slider with more control over the notebooks magnification. enter image description here

However, although I can put the Slider in a Button, when I add the Button to the row of docked cells, it won't do anything. Can this be made to work?

$\endgroup$

1 Answer 1

9
$\begingroup$

Basing only on your description I can't really diagnose the problem. Let me put here something what does what you need but with a slightly different approach:

You don't have to set Magnification to be dynamic and dependent of any symbols, let the Slider itself to change the Magnification:

SetOptions[
 EvaluationNotebook[],
 DockedCells -> {
   ToBoxes @ DynamicModule[{x}, 
     Slider[Dynamic[ x, 
         (x = CurrentValue[EvaluationNotebook[], Magnification] = #) &
         ], {.8, 2, .01}]
     ]
   }
 ]

enter image description here

$\endgroup$
5
  • $\begingroup$ Nice! I'll use this. It's not at all what I would have done, so I'll use it to figure out what I didn't know. $\endgroup$ Feb 19, 2016 at 22:19
  • $\begingroup$ @GeorgeWolfe Feel free to ask if anything is not clear. $\endgroup$
    – Kuba
    Feb 20, 2016 at 6:46
  • 1
    $\begingroup$ related $\endgroup$ Feb 20, 2016 at 9:21
  • $\begingroup$ @SimonWoods at least closely :) $\endgroup$
    – Kuba
    Feb 20, 2016 at 9:22
  • $\begingroup$ @f_s and which notebook's magnification do you want to control? $\endgroup$
    – Kuba
    Dec 21, 2021 at 8:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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