Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adjust Panel Location in a Manipulate object in mathematica

Building up on Sjoerd solution to add alignment to a manipulate object :

Consider the following :

Manipulate[
 Panel[Style[Row1, Bold, 20],
   ImageSize -> 150, Alignment -> Center]
 Panel[Style[Row2, Bold, 20],
   ImageSize -> 150, Alignment -> Center],
{{Row1, {1}}, {1, 2, 3, 4, 5}, ControlType -> SetterBar,ControlPlacement -> Left},
{{Row2, {2}}, {1, 2, 3, 4, 5}, ControlType -> SetterBar,ControlPlacement -> Left}]

enter image description here

Is there a way to have the panel on top of each other aligned with the corresponding SetterBar ?

like image 717
500 Avatar asked May 30 '26 13:05

500


2 Answers

Would something like this work?

Manipulate[
 Grid[{{SetterBar[Dynamic[Row1], {1, 2, 3, 4, 5}], 
    Panel[Style[Row1, Bold, 20], ImageSize -> 150, 
     Alignment -> Center] }, {SetterBar[
     Dynamic[Row2], {1, 2, 3, 4, 5}], 
    Panel[Style[Row2, Bold, 20], ImageSize -> 150, 
     Alignment -> Center]}}], {{Row1, {1}}, 
  ControlType -> None}, {{Row2, {2}}, ControlType -> None}]

manipulate screenshot

This technically moves the controls into the body of the manipulate, and prevents the actual controls from showing up where they normally would.

like image 172
Brett Champion Avatar answered Jun 01 '26 18:06

Brett Champion


DynamicModule[{Row1 = 1, Row2 = 2},
 Manipulate[
  Grid[
   {
    {
      Control[{Row1, {1, 2, 3, 4, 5}}],
      Panel[Style[Row1, Bold, 20], ImageSize -> 150,  Alignment -> Center]
    }, 
    {
      Control[{Row2, {1, 2, 3, 4, 5}}], 
      Panel[Style[Row2, Bold, 20], ImageSize -> 150,  Alignment -> Center]}
    }
   ]
  ]
 ]

enter image description here

like image 34
Sjoerd C. de Vries Avatar answered Jun 01 '26 17:06

Sjoerd C. de Vries