0
$\begingroup$

Is it possible to have sliders and such appear centered on the top or bottom of the panel? The ControlPlacement options only include Top, Bottom, Left, and Right, but the Top placement gives me left-aligned controls, while I want them centered. How do I achieve this?

$\endgroup$
2
  • $\begingroup$ You can put there whatever you want, is that enough?: Overlaying a Plot within a Manipulate Control Panel. $\endgroup$
    – Kuba
    Sep 8, 2016 at 18:58
  • $\begingroup$ No, unless I misunderstand, it's the slider itself the placement of which I want more control over. From the answer below it looks like there's no simple way to achieve this, other than kludges... :-/ $\endgroup$
    – Pirx
    Sep 8, 2016 at 20:19

2 Answers 2

1
$\begingroup$

The Control Image Size control is provided just to demonstrate the approximate automatic centering of the n control at varying image sizes

Manipulate[
 Style[N[Pi, n], Small],
 Column[{
   Control[{{cis, 300, "Control Image Size"}, 100, 500, 50,
     Appearance -> "Labeled"}]},
  ItemSize -> 75,
  Alignment -> Center],
 Column[{
   Control[{{n, 100}, 10^2, 10^4, 10^2,
     Appearance -> "Labeled",
     ImageSize -> cis}]},
  ItemSize -> 75,
  Alignment -> Center],
 AppearanceElements -> None,
 ContentSize -> 600]

enter image description here

$\endgroup$
3
  • $\begingroup$ Ah, that helps, thanks! $\endgroup$
    – Pirx
    Sep 9, 2016 at 0:51
  • $\begingroup$ I don't really get it... When you change ItemSize->75 to any other value, e.g. 50, it's not centered anymore. So how is this different from finding a value for Spacer in my answer? $\endgroup$
    – corey979
    Sep 9, 2016 at 8:28
  • $\begingroup$ @corey979 - I see the difference as the ability to change the ImageSize for the control for n without changing its column's ItemSize $\endgroup$
    – Bob Hanlon
    Sep 9, 2016 at 11:17
0
$\begingroup$

This is a way for a workaround:

Manipulate[
 Style[N[Pi, n], Small], {{n, 100, Row[{Spacer[175], "n"}]}, 100, 
  10000, 100, Appearance -> "Labeled", ImageSize -> Automatic}, 
 AppearanceElements -> None, ContentSize -> 600]

Unfortunately you have to set the argument of Spacer[175] by trial and error; also playing with ContentSize -> 600 and ImageSize -> Automatic might be required for the window to have nice proportions.

$\endgroup$
1
  • $\begingroup$ Hmm, too bad. I guess I'll have to rethink the design I have in mind... $\endgroup$
    – Pirx
    Sep 8, 2016 at 20:21

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.