[Date Index]
[Thread Index]
[Author Index]
Re: How to center the position of a control in the Manipulate pane?
*To*: mathgroup at smc.vnet.net
*Subject*: [mg110455] Re: How to center the position of a control in the Manipulate pane?
*From*: "Alexander Elkins" <alexander_elkins at hotmail.com>
*Date*: Sat, 19 Jun 2010 07:47:43 -0400 (EDT)
*References*: <huvk77$rt4$1@smc.vnet.net> <hv23sv$5g6$1@smc.vnet.net> <hva66c$qjt$1@smc.vnet.net>
Not knowing a way to actually get Manipulate to do the centering
automatically, the cleanest way to do this by hand is to add a Row with
Spacer and text as a label to one of the controls and use it to move the
control to the right, which the rest of the controls then will line up on:
Manipulate[
Plot[a + b*x, {x, 0, 1}, PlotRange -> {0, 10},
ImageSize -> 360], {{a, 4, Row[{Spacer[70], "a"}]}, 1, 5, 1,
Appearance -> "Labeled"}, {{b, 2}, 1, 5, 1, Appearance -> "Labeled"},
AppearanceElements -> None]
Another way is to put the controls in separate rows and again use Spacer:
Manipulate[Plot[a + b*x, {x, 0, 1}, PlotRange -> {0, 10}, ImageSize -> 360],
Row[{Spacer[70],
Labeled[Manipulator[Dynamic[a], {1, 5, 1}, Appearance -> "Labeled"], "a",
Left]}], Row[{Spacer[70],
Labeled[Manipulator[Dynamic[b], {1, 5, 1}, Appearance -> "Labeled"], "b",
Left]}], {{a, 4}, None}, {{b, 2}, None}, AppearanceElements -> None]
Unfortunately, Column centers based on the oversized Manipulator's
Appearance -> "Labeled" which leaves lots of room for its number for and
also needs a Spacer[{360, 0, 0}] to force size within which to center the
rows which also adds its own space above the controls:
Manipulate[Plot[a + b*x, {x, 0, 1}, PlotRange -> {0, 10}, ImageSize -> 360],
Column[{Spacer[360],
Row[{Labeled[Manipulator[Dynamic[a], {1, 5, 1}, Appearance -> "Labeled"],
"a", Left]}],
Row[{Labeled[Manipulator[Dynamic[b], {1, 5, 1}, Appearance -> "Labeled"],
"b", Left]}]}, Center], {{a, 4}, None}, {{b, 2}, None},
AppearanceElements -> None]
Same goes for using Grid instead of Column:
Manipulate[Plot[a + b*x, {x, 0, 1}, PlotRange -> {0, 10}, ImageSize -> 360],
Grid[{{Spacer[360]}, {Labeled[
Manipulator[Dynamic[a], {1, 5, 1}, Appearance -> "Labeled"], "a",
Left]}, {Labeled[
Manipulator[Dynamic[b], {1, 5, 1}, Appearance -> "Labeled"], "b",
Left]}}, Alignment -> Center], {{a, 4}, None}, {{b, 2}, None},
AppearanceElements -> None]
Hope this helps...
Alexander Elkins
"sibir" <martin.rommel at gmail.com> wrote in message
news:hva66c$qjt$1 at smc.vnet.net...
> Thanks to Bob Hanlon for suggesting:
>
> Column[{
> Row[{
> "a ", Slider[Dynamic[a], {1, 5, 1}],
> , a = 4; Dynamic[a]}],
> Row[{
> "b ", Slider[Dynamic[b], {1, 5, 1}],
> , b = 2; Dynamic[b]}],
> Dynamic[Plot[a + b*x, {x, 0, 1},
> PlotRange -> {0, 10},
> ImageSize -> 360]]},
> Center]
>
> It centers the control fine, but does not use Manipulate.
> If I rewrite the exapmle with Manipuate as
>
> Thank you, but I was using Manipulate?
> here si the equivalent:
>
> Manipulate[
> Plot[a+b*x,{x,0,1},PlotRange->{0,10},ImageSize->360],
> {{a,4},1,5,1,Appearance->"Labeled"},
> {{b,2},1,5,1,Appearance->"Labeled"},
> AppearanceElements->None,
> Alignment -> Center]
>
> The contro lis flush left again, the option Alignment acts only in the
> white Display area and not on the controls.
> The option ControlPlacement appears somewhat limited and has no Center
> setting.
>
> Options[Manipulate] shows that there is also ControlAlignment, but I
> cannot find any documentation for that option (the Documentation
> Center links to RandomChoice!?!).
> What are defined settings for ControlAlignment?
>
>
>
Prev by Date:
**Re: Difficulty with saving Package .m files**
Next by Date:
**Workbench fails to build documentation**
Previous by thread:
**Re: How to center the position of a control in the Manipulate pane?**
Next by thread:
**Dyads**
| |