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}]
Is there a way to have the panel on top of each other align开发者_如何学Pythoned with the corresponding SetterBar ?
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}]
This technically moves the controls into the body of the manipulate, and prevents the actual controls from showing up where they normally would.
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]}
}
]
]
]
You could also do:
Manipulate[
Column[
{Panel[Style[Row1, Bold, 20], ImageSize -> {150, 50}, Alignment -> Center] ,
Panel[Style[Row2, Bold, 20], ImageSize -> {150, 50}, Alignment -> Center]}],
Column[
{
Control@{{Row1,{},Pane["",ImageSize->{0, 50}]},Range@5,ControlType -> SetterBar},
Control@{{Row2,{},Pane["",ImageSize->{0, 50}]},Range@5,ControlType -> SetterBar}
}],
ControlPlacement -> Left]
精彩评论