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


Groups > comp.soft-sys.math.mathematica > #6947 > unrolled thread

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

Started byTomas Garza <tgarza10@msn.com>
First post2011-12-05 10:32 +0000
Last post2011-12-07 11:25 +0000
Articles 4 — 3 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Re: reducing the size of a Manipulate slider control, problem when using ImageSize Tomas Garza <tgarza10@msn.com> - 2011-12-05 10:32 +0000
    Re: reducing the size of a Manipulate slider control, problem when using ImageSize Chris Young <cy56@comcast.net> - 2011-12-06 08:21 +0000
    Re: reducing the size of a Manipulate slider control, problem when using ImageSize Chris Young <cy56@comcast.net> - 2011-12-06 08:22 +0000
    Re: reducing the size of a Manipulate slider control, problem when using ImageSize Christopher Young <cy56@comcast.net> - 2011-12-07 11:25 +0000

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

FromTomas Garza <tgarza10@msn.com>
Date2011-12-05 10:32 +0000
SubjectRe: reducing the size of a Manipulate slider control, problem when using ImageSize
Message-ID<jbi6j5$532$1@smc.vnet.net>
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}], White, Disk[p1, 0.02]},       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}}]],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}]}]]}]
-Tomas

> Date: Sun, 4 Dec 2011 02:50:19 -0500
> From: cy56@comcast.net
> Subject: Re: reducing the size of a Manipulate slider control, problem when using ImageSize
> To: mathgroup@smc.vnet.net
>
> I've been trying to have small sliders, too. Finally figured out what
> the Help on Manipulate meant: you put the "ImageSize -> Tiny" (or
> whatever size) _after_ ControlType -> Slider (or whatever the type).
> Unfortunately, you need to do this redundant specification if you want
> to change the size of any controls in Manipulate. Or at least you do
> for sliders.
>
> Chris Young
> cy56@comcast.net
>
> Manipulate[
>  foo[],
>
>   {x, 0, 1, ControlType -> Slider, ImageSize -> Tiny}
>  ]
>
>
> On 2007-09-04 08:00:14 +0000, Nasser Abbasi said:
>
> > 6.0.1:
> >
> > Problem to solve is this: Trying to control the size of the controls that
> > used by different manipulate entries. For example, this will produce a
> > slider:
> >
> > Manipulate[foo[],{x,0,1}]
> >
> > But when I did the following below, the slider went away! (is this a bug or
> > a feature?)
> >
> > Manipulate[foo[], {{x, 0, 1}, ImageSize -> Tiny}]
> >
> > I can;t explain what it did that. According to help, Slider does have an
> > ImageSize option, so I figured I'll try it here.
> > How else can one make the above slider in Manipulate smaller in size? Iwant
> > to fit 2 slider next to each others instead of on top of each others onthe
> > screen.
> >
> > thanks,
> > Nasser
>
>

[toc] | [next] | [standalone]


#6971

FromChris Young <cy56@comcast.net>
Date2011-12-06 08:21 +0000
Message-ID<jbkja7$i51$1@smc.vnet.net>
In reply to#6947
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"}}
 ]

[toc] | [prev] | [next] | [standalone]


#6972

FromChris Young <cy56@comcast.net>
Date2011-12-06 08:22 +0000
Message-ID<jbkjc7$i5l$1@smc.vnet.net>
In reply to#6947
How could I abbreviate the set of Style[ ] statements below?

Block[
 {opts},
 
 Manipulate[
  opts = {Background -> White, 12, "Label"};
  
  Graphics[
   {
    {Line[{p1, p2, p3, p1}]},
    
    Style[Text["A", p1], opts], 
    Style[Text["B", p2], opts], 
    Style[Text["C", p3], opts]
    },
   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}}, {0, 0}, {1, 1}}, 
  {{p2, {0.5, 0}}, {0, 0}, {1, 1}}, 
  {{p3, {0, 0.5}}, {0, 0}, {1, 1}},
  
  ControlPlacement -> Left,
  FrameLabel -> {{"", ""}, {"", "Moving labelled points via 2D sliders"}}
  ]
 ]

I've tried everything I can think of, but nothing seems to work.

Block[
 {opts},
 
 Manipulate[
  opts = {Background -> White, 12, "Label"};
  
  Graphics[
   {
    {Line[{p1, p2, p3, p1}]},
    
    Style @@@ 
     Table[
      {Text[k], opts},
      {k, {{"A", p1}, {"B", p2}, {"C", p3}}}
      ]
    },
   
   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}}, {0, 0}, {1, 1}}, 
  {{p2, {0.5, 0}}, {0, 0}, {1, 1}}, 
  {{p3, {0, 0.5}}, {0, 0}, {1, 1}},
  
  ControlPlacement -> Left,
  FrameLabel -> {{"", ""}, {"", "Moving labelled points via 2D sliders"}}
  ]
 ]

[toc] | [prev] | [next] | [standalone]


#6996

FromChristopher Young <cy56@comcast.net>
Date2011-12-07 11:25 +0000
Message-ID<jbniff$4aj$1@smc.vnet.net>
In reply to#6947
Thanks very much, this is a huge help.

On Dec 6, 2011, at 9:12 AM, Bob Hanlon wrote:

> 
> {Style[Text["A", p1], opts], Style[Text["B", p2], opts],
> Style[Text["C", p3], opts]}
> 
> 
> Style[Text[#[[1]], #[[2]]], opts] & /@
> Thread[{{"A", "B", "C"}, {p1, p2, p3}}]
> 
> {Style[Text["A", p1], opts], Style[Text["B", p2], opts],
> Style[Text["C", p3], opts]}
> 
> 
> Style[Text[#[[1]], #[[2]]], opts] & /@
> {{"A", p1}, {"B", p2}, {"C",
>   p3}}
> 
> {Style[Text["A", p1], opts], Style[Text["B", p2], opts],
> Style[Text["C", p3], opts]}
> 
> 
> Style[Text[Sequence @@ #], opts] & /@
> {{"A", p1}, {"B", p2}, {"C",
>   p3}}
> 
> {Style[Text["A", p1], opts], Style[Text["B", p2], opts],
> Style[Text["C", p3], opts]}
> 
> 
> % == %% == %%% == %%%%

Chris Young
cy56@comcast.net

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web