Background: I want to split graphics in a Manipulate in several parts in a tabview control. But the tabview somehow interferes with the locators as in the following simplified example:
Manipulate[
TabView[{aa -> Graphics[Line[{{0, 0}, p}], PlotRange -> 1],
bb -> 1}] , {{p, {1, 1}}, Locator}]
Question: How to use Locators on a graphic in a tabview. ( How to get the snippet above working ? )
EDIT:
I left out too much in the previous example, this is a better description.
Manipulate[
pts1 = pts;
TabView[{
a -> Graphics[Line[pts1]],
b -> Graphics[Line[pts]]}],
{{pts, ptsI}, Locator, LocatorAutoCreate -> All},
Initialization -> {pts = {{0, 0.5}, {0, 0.6}}}]
So, there is one set of data, in this example pts. In one part of the display (A) the data is modified, the data is then shown on ( B ). -
Answer
Maybe something like
Manipulate[pts1 = p; pltrng = {{-1, 1}, {-1, 1}};
pnts = LocatorPane[Dynamic[p, {(pts1 = p; p = #) &, (p = #) &}],
Dynamic@Graphics[Point[p], PlotRange -> pltrng],
LocatorAutoCreate -> True];
tbl = Dynamic[Grid[Table[With[{i = i}, {i, Dynamic[pts1[[i]]]}], {i, Length@pts1}]]];
ln = Dynamic@ Graphics[{Red, Thick, Line[pts1]}, PlotRange -> pltrng];
bzc = Dynamic@ Graphics[{Blue, BezierCurve[pts1]}, PlotRange -> pltrng];
dsk = Dynamic@ Graphics[{Orange, Disk[#, .1] & /@ pts1}, PlotRange -> pltrng];
plygn = Dynamic@ Graphics[{Green, Polygon[pts1]}, PlotRange -> pltrng];
allviews = Grid[{{pnts, tbl, dsk}, {ln, bzc, plygn}}, Dividers -> {All, All}];
TabView[{"locators" -> pnts, "table" -> tbl, "line" -> ln, "beziercurve" -> bzc,
"disks" -> dsk, "polygon" -> plygn, "all" -> allviews},
Alignment -> Center],
{{p, {{-.5, -0.5}, {-.25, .5}, {.6, 0.6}}}, None}]

Comments
Post a Comment