This creates two locked sliders
DynamicModule[{p = {2 π, 0}, r},
{Slider2D[Dynamic[r]], Slider2D[Dynamic[1 - r, (r = 1 - #) &]]}]
How can I add a check box so that I can control whether to lock them or not? If the check box is check, the second slider sync to the first one and then they are locked as above, and if the check box is unchecked, they they can move independently.
I tried something like this
DynamicModule[{p = {2 π, 0}, checked = True, r,r2 },
{Slider2D[Dynamic[r]], Slider2D[Dynamic[If[checked, 1 - r, r2]]],
Checkbox[Dynamic[checked]]}]
or this
DynamicModule[{p = {2 π, 0}, r, r2, checked = True},
{Slider2D[Dynamic[r]],
Refresh@If[checked, Slider2D[Dynamic[1 - r, (r = 1 - #) &]],
Slider2D[Dynamic[r2]]], Checkbox[Dynamic[checked]]}]
but neither of them worked.