I'm adding this answer late because I think it would be good to have an example of OpenerView
given as an argument to Manipulate
, a common use-case for OpenerView
. I also want to point out a special consideration which must be made when specifying controls in such a situation.
SeedRandom[3];
With[{nMax = 16, rMax = 12., extent = 300},
With[{redPts = RandomReal[{12., extent - 12}, {nMax, 2}],
blkPts = RandomReal[{12., extent - 12}, {nMax, 2}]},
Manipulate[
Graphics[{
{Red, Disk[#, redR] & /@ redPts[[;; redN]]},
{Black, Disk[#, blkR] & /@ blkPts[[;; blkN]]}},
PlotRange -> {{0, extent}, {0, extent}}],
OpenerView[{"Red",
Column[{
Control[{{redN, 1, "number"}, 0, nMax, 1, Slider}],
Control[{{redR, 4., "radius"}, 4., rMax, 2., Slider}]}]},
True, ImageSize -> extent],
OpenerView[{"Black",
Column[{
Control[{{blkN, 1, "number"}, 0, nMax, 1, Slider}],
Control[{{blkR, 4., "radius"}, 4., rMax, 2., Slider}]}]},
True, ImageSize -> extent],
FrameLabel -> {{None, None}, {None, Style["Random Spots", "SB", 14]}},
ContentSize -> {extent, extent},
ControlPlacement -> Bottom]]]
The special consideration I want to be noticed is that the control descriptions, which would be lists had they been given directly as arguments to Manipulate
, must be wrapped with Control
when they are arguments of an argument of Manipulate
.