2011-06-24 27 views
3

构建上Sjoerd solution to add alignment to a manipulate object调整面板位置的操纵对象Mathematica中

考虑以下几点:

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

有没有办法对每一个顶部面板其他与相应的SetterBar对齐?

回答

3

会这样的工作?

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

这在技术上移动控制到的操纵机构,并且防止实际控制从显示出来,他们通常会。

+0

谢谢。我发布的问题是实际问题的简化版本。我还没有能够在“真正”的解决方案上实施你的解决方案。我在这里上传了一个简单的笔记本:http://www.laeh500.com/LAEH/Panel_Problem.html。你有时间看看吗,如果你认为它可行,你能告诉我吗?非常感谢。 – 500

+0

@ 500现在能为你工作吗? –

+0

@Wizard先生,我从来没有成功地将它应用于我的问题。我使用了静态替代方法。 – 500

1

你也可以这样做:

Manipulate[ 
Column[ 
    {Panel[Style[Row1, Bold, 20], ImageSize -> {150, 50}, Alignment -> Center] , 
    Panel[Style[Row2, Bold, 20], ImageSize -> {150, 50}, Alignment -> Center]}], 
Column[ 
{ 
[email protected]{{Row1,{},Pane["",ImageSize->{0, 50}]},[email protected],ControlType -> SetterBar}, 
[email protected]{{Row2,{},Pane["",ImageSize->{0, 50}]},[email protected],ControlType -> SetterBar} 
    }], 
ControlPlacement -> Left] 

enter image description here

3
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