If you want to write a function that updates the value of a specific variable, it is like passing a variable by reference. The standard way to achieve this in Mathematica is to use Hold* attributes for your function.
SetAttributes[SinLocatorPane, HoldFirst]; SinLocatorPane[sinvalue_] := LocatorPane[Dynamic[x, (x =
Then
{Dynamic[sv], SinLocatorPane[sv]}
will work as your expected. Your code worked because Dynamic assigned HoldFirst , and this allowed your code to update the sinvalue variable. Otherwise, Dynamic is not really needed.
Sasha source share