Enabled in Manipulate ...
- To: mathgroup at smc.vnet.net
- Subject: [mg112583] Enabled in Manipulate ...
- From: annetts729 <annetts729 at gmail.com>
- Date: Tue, 21 Sep 2010 02:04:30 -0400 (EDT)
Hi,
I have the following Manipulate[] block.
Manipulate[
p1 = Switch[l, 1, True, _, False];
p2 = Switch[l, 2, True, _, False];
poly1 = {{-2, 1}, {-2, 0}, Sort@u, {2, 0}, {2, 1}};
poly2 = {{-2, -1}, {-2, 0}, Sort@u, {2, 0}, {2, -1}};
poly3 = {{-2, -2}, {-2, -1}, {2, -1}, {2, -2}};
poly1 = {Directive[Red], Polygon[FlattenAt[poly1, 3]]};
poly2 = {Directive[Lighter@Gray], Polygon[FlattenAt[poly2, 3]]};
poly3 = {Directive[Blue], Polygon[poly3]};
Graphics[{poly1, poly2, poly3}, PlotRange -> {All, {-2, 1}},
Frame -> True, PlotLabel -> l],
{{u, {{-1, 0}, {1, 0}}}, Locator, LocatorAutoCreate -> {2, 10},
Enabled -> p1},
{{l, 1, "Lyr"}, {1, 2}}]
By moving & adding locators, I can change the boundary between the red
& gray polygons.
My reading of Enabled says that when I set the button to "2", the
locators shouldn't work.
But they do, at least under 7.0.1 (Windows).
Assuming (!) my reading is correct, how do I render these locators
inactive?
It's reasonably obvious that I'd like to put another Locator[] between
the gray & blue rectangles, and in so doing, be able to change the
nature of the boundary of the central body, but it seems impossible to
do this. Is it possible to have multiple Locators on a Manipulate?
Many thanks,
Dave.