I'm trying to create a function that uses a dynamic locatorpane to populate a list with the coordinates of user defined locators (added by alt+clicking). This code works fine:
one = ExampleData[{"TestImage", "Airplane"}]
ptsa = {};
ptsb = {};
Button["Reset points", ptsa = {}]
LocatorPane[Dynamic[ptsa],
Dynamic[
Show[one,
Graphics[{
Table[(*draw arrows between locators*)
Arrow[{
ptsa[[i]], ptsa[[i + 1]]
}],
{i, 1, Floor[Length[ptsa], 2], 2}
],
Table[
Text[(i + 1)/2,
ptsa[[i]] + (ptsa[[i + 1]] - ptsa[[i]])/2 +
Cross[ptsa[[i + 1]] - ptsa[[i]]]/
EuclideanDistance[ptsa[[i + 1]],
ptsa[[i]]]*10],(*display line # 5 pixels orthogonal to line \
midpoint*)
{i, 1, Floor[Length[ptsa], 2], 2}
]
}]
]
],
LocatorAutoCreate -> True,
Appearance -> Style["\[CenterDot]", Medium, Red]]
That works for the single list: "ptsa" and allows me to insert points into "ptsa" with a point-and-click interface.
However, I need to do this for many different lists (ptsb, ptsc, ptsd, etc). I tried making a function ui[ptsa_] := LocatorPane[...] so I can just do ui[ptsb] in the future, but this simply inserts {} into ptsa, which doesn't help.
I also tried defining the above simply as a = LocatorPane[...] and trying
a /. ptsa -> ptsb
but that doesn't work either. I'm not sure how to approach this.

LocatorPaneand other details are not relevant there. Please take a look at HoldFirst documentation's examples, I believe there is the answer to your question. – Kuba Apr 06 '16 at 05:37