How to use Locators on a graphic in a tabview

Maybe something like

pltrng = {{-1, 1}, {-1, 1}};

Manipulate[pnts = LocatorPane[Dynamic[p], 
   Dynamic @ Graphics[Point[p], PlotRange -> pltrng], 
   LocatorAutoCreate -> True];
 tbl = Dynamic @ Grid[MapIndexed[{#2[[1]], #} &, p]];
 ln = Dynamic @  Graphics[{Red, Thick, Line[p]}, PlotRange -> pltrng]; 
 bzc = Dynamic @ Graphics[{Blue, BezierCurve[p]}, PlotRange -> pltrng];
 dsk = Dynamic @ Graphics[{Orange, Disk[#, .1] & /@ p}, PlotRange -> pltrng];
 plygn = Dynamic@ Graphics[{Green, Polygon[p]}, PlotRange -> pltrng];
 allviews =  Grid[{{pnts, tbl, dsk}, {ln, bzc, plygn}}, Dividers -> {All, All}];
 Dynamic @ 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}]

enter image description here


One way to get it working is to do something like

Manipulate[TabView[{
   aa -> LocatorPane[Dynamic[p], Dynamic@Graphics[Line[{{0, 0}, p}], PlotRange -> 1]], 
   bb -> 1}], 
 {{p, {1, 1}}, None}]

You can move the TabView outside the Manipulate and it works:

TabView[{
    aa -> Manipulate[Graphics[Line[{{0, 0}, p}], PlotRange -> 2], {{p, {1, 1}}, Locator}], 
    bb -> 1}
]

enter image description here enter image description here

Tags:

Manipulate