MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Size of Control[] and OpenerView in Manipulate

  • To: mathgroup at smc.vnet.net
  • Subject: [mg121835] Re: Size of Control[] and OpenerView in Manipulate
  • From: Club de Ultimate Ki-e <ultimatekie at gmail.com>
  • Date: Tue, 4 Oct 2011 01:33:04 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <j5f61u$q53$1@smc.vnet.net>

On Sep 22, 7:26 am, W Craig Carter <ccar... at mit.edu> wrote:
> I would like to change the size of some controls in a Manipulate andalso 
use an OpenerView.
>
> For reference, I am looking at this nice examplefrom about 9/10 towards
> the bottom of "tutorial/AdvancedManipulateFunctionality":
>
> Manipulate[
>  ParametricPlot[{a1 Sin[n1 (x + p1)], a2 Cos[n2 (x + p2)]}, {x, 0,
>    20 Pi}, PlotRange -> 1.1, PerformanceGoal -> "Quality",
>   Axes -> axes, ImageSize -> size],
>  OpenerView[{"Horizontal",
>    Column[{Control[{{n1, 1, "Frequency"}, 1, 4}],
>      Control[{{a1, 1, "Amplitude"}, 0, 1}],
>      Control[{{p1, 0, "Phase"}, 0, 2 Pi}]}, Right]}],
>  OpenerView[{"Vertical",
>    Column[{Control[{{n2, 5/4, "Frequency"}, 1, 4}],
>      Control[{{a2, 1, "Amplitude"}, 0, 1}],
>      Control[{{p2, 0, "Phase"}, 0, 2 Pi}]}, Right]}],
>  OpenerView[{"Plot options",
>    Row[{Control[{axes, {True, False}}],
>      Control[{{size, Medium}, {Small, Medium, Large}}]},
>     Spacer[20]]}], ControlPlacement -> Bottom]
>
> 1. I'd like the Control[] results to be smaller. However, Control
> doesn't seem to have an option to control its ImageSize.
>
> 2. If I try to replace Control with, say, Slider for which I can control
> size, it doesn't work. I don't know why it doesn't work, but it doesn't
> look like it is being evaluated.
>
> 3. Even better would be to replace Control with a custom control like
> the next example down in the tutorial,  ValueThumbSlider.
>
> Thanks for any explanation or solution, Craig
>
> W Craig Carter
> Professor of Materials Science, MIT


Hello,
You need to create your own slider. It's easy:

mySlider[Dynamic[var_], {min_, max_}, size_] :=  Slider[Dynamic[var],
{min, max}, ImageSize -> size]

Now size is an option. You can use it stand-alone

mySlider[Dynamic[x], {0, 1}]

Or in Manipulate:

Manipulate[x, {{x, 1, "jorge"}, mySlider[##, {0, 1}, 50] &}]

Have fun.

Jorge Ramirez
Professor of Mathematics, UNAL, Medellin, Colombia.




  • Prev by Date: Re: Solve - takes very long time
  • Next by Date: Re: Solve - takes very long time
  • Previous by thread: CreateDocument with nested CellGroup problem.
  • Next by thread: Fully vectorized system of ODE's - any advantage of C?