Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #6980

Re: reducing the size of a Manipulate slider control, problem when using ImageSize

From Tomas Garza <tgarza10@msn.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: reducing the size of a Manipulate slider control, problem when using ImageSize
Date 2011-12-07 11:17 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jbni05$478$1@smc.vnet.net> (permalink)

Show all headers | View raw


Yes, I think it's a good idea to experiment with different approaches. As for the Module inside my Manipulate, you're right; it's not necessary and only reflects on my habit of starting anything with a Module so as to have all variables properly localized. In this example there are no variables other than the controls.
-Tomas

> Date: Tue, 6 Dec 2011 03:14:21 -0500
> From: cy56@comcast.net
> Subject: Re: reducing the size of a Manipulate slider control, problem when using ImageSize
> To: mathgroup@smc.vnet.net
>
> On 2011-12-05 10:32:05 +0000, Tomas Garza said:
> It's not necessarily redundant, since you might want to have different
> sizes for the sliders (or whatever control you use). Take a look at
> this example:
>
> Column[
>  {
>   Style["Different size sliders in the same row", 13, "Label"],
>  
>   Manipulate[
>    Module[
>     {},
>    
>     Graphics[
>      {
>       {Line[{p1, p2, p3, p1}], Yellow, Disk[p1, 0.05]},
>      
>       Style[Text["A", p1], Background -> White, Bold, Italic, 12, "Label"],
>       Style[Text["B", p2], Background -> White, Bold, Italic, 12, "Label"],
>       Style[Text["C", p3], Background -> White, Bold, Italic, 12, "Label"]
>       },
>      PlotRange -> {{-0.2, 1.2}, {-0.2, 1}},
>      Axes -> True
>      ]
>     ],
>   
>    Row[
>     {
>      Spacer[35],
>      Control[{{p1, {0, 0}, "A"}, {0, 0}, {1, 1}, ImageSize -> 25}],
>      Spacer[50],
>      Control[{{p2, {1, 0}, "B"}, {0, 0}, {1, 1}, ImageSize -> 50}],
>      Spacer[50],
>      Control[{{p3, {0.5, 0.5}, "C"}, {0, 0}, {1, 1}, ImageSize -> 75}]
>      }
>     ]  (* Row *)
>    ]  (* Manipulate *)
>   }
>  ]  (* Column *)
>
> Thanks, that's good to know. It looks like Manipulate will accept the
> following, too. Here the Row[ ] of controls seems to be accepted as a
> valid set of control specifications, so we don't need the Module.
>
> Column[
>  {
>   Style["Different size sliders in the same row", 13, "Label"],
>  
>   Manipulate[
>    Graphics[
>     {
>      {Line[{p1, p2, p3, p1}], Yellow, Disk[p1, 0.05]},
>     
>      Style[Text["A", p1], Background -> White, Bold, Italic, 12, "Label"],
>      Style[Text["B", p2], Background -> White, Bold, Italic, 12, "Label"],
>      Style[Text["C", p3], Background -> White, Bold, Italic, 12, "Label"]
>      },
>     PlotRange -> {{-0.2, 1.2}, {-0.2, 1}},
>     Axes -> True
>     ],
>   
>    Row[
>     {
>      Spacer[35],
>      {p1, {0, 0}, {1, 1}},
>      Spacer[50],
>      Control[{{p2, {1, 0}, "B"}, {0, 0}, {1, 1}, ImageSize -> 50}],
>      Spacer[50],
>      Control[{{p3, {0.5, 0.5}, "C"}, {0, 0}, {1, 1}, ImageSize -> 75}]
>      }
>     ]  (* Row *)
>    ]  (* Manipulate *)
>   }
>  ]  (* Column *)
>
>
> Also, I managed to get it down to the following, just to experiment
> with the different labelling options. Might as well use FrameLabel
> instead of going through the trouble of setting up a Row, although you
> still have to fuss with the nested curly brackets to specify which side
> you want the label on.
>
> Manipulate[
>  Graphics[
>   {
>    {Line[{p1, p2, p3, p1}], Yellow, Disk[p1, 0.05]},
>   
>    Style[Text["A", p1], Background -> White, Bold, Italic, 12, "Label"],
>    Style[Text["B", p2], Background -> White, Bold, Italic, 12, "Label"],
>    Style[Text["C", p3], Background -> White, Bold, Italic, 12, "Label"]
>    },
>   PlotRange -> {{-0.2, 1.2}, {-0.2, 1}},
>   Axes -> True,
>   PlotLabel -> "Triangle points via 2D sliders"
>   ],
> 
>  Item["2D sliders in a column", ControlPlacement -> Center],
> 
>  {p1, {0, 0}, {1, 1}},
>  {p2, {0, 0}, {1, 1}},
>  {p3, {0, 0}, {1, 1}},
> 
>  ControlPlacement -> Left,
>  FrameLabel -> {{"", ""}, {"", "Moving labelled points via 2D sliders"}}
>  ]
>

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: reducing the size of a Manipulate slider control, problem when using ImageSize Tomas Garza <tgarza10@msn.com> - 2011-12-07 11:17 +0000

csiph-web