Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have discovered a problem with OpenerView. My opener views always close when I change the value of the manipulator control in my Manipulate.

A simple example:

Manipulate[
  Column[
   {OpenerView[{"plot1", Panel@Plot[x^2, {x, -10, 2}]}, False], 
    OpenerView[{"plot2", Panel@Plot[x^2 + 3 x, {x, -10, 2}]}, False], 
    Plot3D[Sin[ n x y], {x, -2, 2}, {y, -2, 2}]}],
 {n, 1, 10, 1}]

enter image description here

I tried the option ContentSize in the Manipulate and ImageSize in the OpenerView, but both failed.

My question is what options do I need to add to make the interface to keep the state of the opener views unchanged when I change the value of the slider for n?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

As long as the opener views are part of the first argument of a Manipulate, they will be evaluated every time the Manipulator control for n is evaluated. This means openers will always either close or open (depending on the value of their optional second argument) when the slider is moved. This will be true even if they are wrapped in a Refresh[..., None] expresion.

The only solution I can see is to take the opener views out of the first argument (i,e., the content pane) and make them annotations.

Manipulate[
   Plot3D[Sin[n x y], {x, -2, 2}, {y, -2, 2}],
   {n, 1, 10, 1, ImageSize -> Large},
   OpenerView[{"plot1", Panel @ Plot[x^2, {x, -10, 2}]}], 
   OpenerView[{"plot2", Panel @ Plot[x^2 + 3 x, {x, -10, 2}]}]]

This will change the look of your GUI, but only a little. It will work for your example because it has no dynamic content. Annotations permit dynamic content, but managing such content would mean a little more work.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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