Отрегулируйте расположение панели в объекте Manipulate в mathematica - PullRequest
3 голосов
/ 24 июня 2011

Построение на решении Sjoerd для добавления выравнивания к объекту манипуляции :

Рассмотрим следующее:

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 ]

3 голосов
/ 24 июня 2011
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

3 голосов
/ 24 июня 2011

Хотелось бы что-нибудь подобное?

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

Это технически перемещает элементы управления в тело манипулятора и предотвращает отображение реальных элементов управления там, где они обычно находятся.будет.

1 голос
/ 24 июня 2011

Вы также можете сделать:

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]  

enter image description here

...