2011-06-24 68 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