1
$\begingroup$

Column does not maintain Alignment settings when OpenerView opens and closes.

Column[{Graphics[{Blue, Rectangle[{0, 0}, {1, .25}]}, 
   ImageSize -> Small],
  Sequence @@ ConstantArray[
    OpenerView[{"Text and Stuff wider than the graphic",
      "Wide grid of numbers and a lot of stuff and the like."}, False],
    3]},
 Alignment -> {{Center, {Left}}, Automatic}] 

enter image description here

The above Column displays as expected. The first row is centred and the remaining rows are aligned to the left. However, look at what happens if I open a one of the OpenerView items.

enter image description here

The rows that should be aligned to the left change their alignment to centre. The behaviour is:

  • All OpenerViews closed then they are correctly aligned to the left.
  • Any OpenerView open is aligned to the left but those closed are aligned center.

Have I spec'd Alignment incorrectly or is this a bug?


Adding that the same happens with Grid.

Grid[{{Graphics[{Blue, Rectangle[{0, 0}, {1, .25}]}, 
    ImageSize -> Small]},
  Sequence @@ ConstantArray[
    OpenerView[{"Text and Stuff wider than the graphic",
      "Wide grid of numbers and a lot of stuff and the like."}, False],
    {3, 1}]},
 Alignment -> {{Center, {Left}}, Automatic}]
$\endgroup$
  • $\begingroup$ Try OpenerView[..., ImageSize->All]. Then it won't jump around. $\endgroup$ – Jack LaVigne Sep 14 '15 at 23:29
  • $\begingroup$ @JackLaVigne That was the ticket. I need to use ImageSize -> {All, Automatic} instead of just ImageSize -> All as the hidden grid is tall. Post this as an answer. $\endgroup$ – Edmund Sep 14 '15 at 23:46
0
$\begingroup$

The documentation says that for OpenerView the option ImageSize -> Automatic instructs it to only leave space for the expressions that are in view.

With ImageSize -> All it will leave space for the largest expression.

Column[{
  Graphics[{Blue, Rectangle[{0, 0}, {1, .25}]}, ImageSize -> Small],
  Sequence @@ ConstantArray[
    OpenerView[{
      "Text and Stuff wider than the graphic",
      "Wide grid of numbers and a lot of stuff and the like."
      },
     False,
     ImageSize -> All],
    3
    ]},
 Alignment -> {{Center, {Left}}, Automatic}
 ]

This gives a column that looks like this with the first element open:

Mathematica graphics

If you want to control the width and height independently you can use:

Grid[{
  {Graphics[{Blue, Rectangle[{0, 0}, {1, .25}]}, ImageSize -> Small]},
  Sequence @@ ConstantArray[
    OpenerView[
     {
      "Text and Stuff wider than the graphic", 
      "Wide grid of numbers and a lot of stuff and the like."
      },
     False,
     ImageSize -> {All, Automatic}
     ],
    {3, 1}
    ]},
 Alignment -> {{Center, {Left}}, Automatic}
 ]

Here the width is the width of the maximum width of all of the components but the height will only display what is required to display what is on the screen.

Mathematica graphics

$\endgroup$
  • $\begingroup$ This helped. I've gone with ImageSize -> {All, Automatic} instead as the hidden grid is very tall. $\endgroup$ – Edmund Sep 16 '15 at 23:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.