Reposition WebSDK Control

I have created a custom button using the WebSDk as advised here. Everything seemed to be working greate until I tried to reposition the control at runtime using the Top and Left properties. Must I manually Update the controls position using javascript? Any help would be much appreciated.

Put the WebSDK control in a WebContainer of exactly the same size, lock all sides, and put the WebContainer on the WebPage. You will then be able to move and resize it.

If you make Top and Left computed properties you can send the Javascript to change the CSS positioning when changed.

I would have assumed Xojo handled something like that though, but I just got tripped up on assuming it would handle visibility recently so I’m not exactly surprised.

To directly answer your question, yes, everything should be done as JavaScript. There should be an event for you to capture for when framework properties change.

Keep in mind that the upper left corner of a control doesn’t always match the x and y set by a user. Sometimes there’s a buffer div or a border that you need to offset from. Thus we make it your responsibility to change.

Well ■■■■, it’s always the simple ones you forget.

Thank you, Michel, for the workaround.

[quote=289643:@Greg O’Lone]To directly answer your question, yes, everything should be done as JavaScript. There should be an event for you to capture for when framework properties change.

Keep in mind that the upper left corner of a control doesn’t always match the x and y set by a user. Sometimes there’s a buffer div or a border that you need to offset from. Thus we make it your responsibility to change.[/quote]

Thanks Greg. Tim Parnell mentioned using a computed property to get access to said event to capture. would you agree with this?

Using the FrameworkPropertyChanged event to capture the changed property and it’s value is a better way to handle it unless you want to create duplicate properties for everything.

All working well! I had to set the CSS margin properties to 0px for they were at 20px by default. I am now wrestling with the web animator. I posted a question in a new thread. https://forum.xojo.com/35710-websdk-vs-webanimator