I have a button, with a script that runs on mouseClicked, which calls event.source.setLocation(x, y). The button does move to the specified location, but it quickly returns to its original position (when in designer), or stays in the new position until you click somewhere inside the window (but not on another component) when running the client.
How do you move components via scripting without them moving back to the original location?
What I am trying to work up to is being able to drag components around inside the client with the mouse.
system.gui.transform works great, thank you for the suggestion as I found that system.gui.moveComponent worked fine as long as you did not maximize the client (changing the scaling), but as soon as the scaling changed, it would not work as intended.
For context, this is what i ended up with while attempting to make a component "draggable" It seems to work great, but I'm all ears on better ways to accomplish this.
Thanks for starting this post. I tried your script on a group (polygon and a numeric label). I put the script in the event handler for the group, (I right clicked on the group and selected scripting..) I pasted the above into the MousePressed and MouseDragged events. I got the following error.
I don't really need to click and drag. I just need to position dynamically on load. I like the added functionality of your solution though. Thinking the user can drag the group to set the new level.
I'm building an HMI for a wetwell and want an indicator(a triangle and a numeric label) for the Lead and Lag start level for the pumps (the group will be dynamically placed on load to a scaled height on the wetwell).
In Wonderware this was three clicks and expression. Not sure why I don't have exposure to the x,y postion of the group once I add a Numeric label. I can move a group of polygons all day.