XWidgetSoft Forum
https://xwidget.com/bbs/

Lock Widget Position
https://xwidget.com/bbs/viewtopic.php?f=8&t=5223
Page 1 of 1

Author:  theyinas [ November 11th, 2014, 1:13 am ]
Post subject:  Lock Widget Position

Hello.
Is it possible to lock the widget position via code?
My purpose would be to have a lock/unlock button for the user to click to lock/unlock the widget (or a certain element).
I couldn't seem to find it via code so far...

Thanks for your help!

-yinas

Author:  Jimking [ November 11th, 2014, 5:16 am ]
Post subject:  Re: Lock Widget Position

The XW has a default right click option to lock a single widget or all together.
So I don't see the meaning of creating a widget/button like this...
Now if you still want this you need to wait for a reply for the users who know more about js code.

Author:  hamid [ November 11th, 2014, 6:53 am ]
Post subject:  Re: Lock Widget Position

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"
}

Author:  theyinas [ November 11th, 2014, 6:56 am ]
Post subject:  Re: Lock Widget Position

hamid wrote:
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


thank you Hamid, will try it out soon.
.... i thought i tried this one before already <_< *me fail*

Author:  meme [ November 11th, 2014, 11:23 am ]
Post subject:  Re: Lock Widget Position

Great reply hamid :)

Page 1 of 1 All times are UTC - 8 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/