Code:
widget.LockPosition=1 //widget's lockposition will be enabled
widget.LockPosition=0 //widget's lockposition will be disabled
widget.LockPosition=!widget.LockPosition //will toggle widget's lockposition
Note:if you want to change the button's image accordingly, better to use if..else instead of above toggling,
since it can get unsync,
example:
Code:
if(widget.LockPosition)
{
widget.LockPosition=0 //widget's lockposition will be disabled
image1.Src="enable.png"
}
else
{
widget.LockPosition=1 //widget's lockposition will be enabled
image1.Src="disable.png"
}