WebSDK vs. WebAnimator

Thanks to the answers provided here Reposition WebSDK Control I am now able to reposition the custom controls at runtime! However, the webAnimator does not work with the custom control. Is there an easy way to enable WebAnimator requests?

Same response. Embed your WebSDK control in a WebContainer to enable WebAnimator to do its magic.

That said, I just filed a feature request. I hope Greg will consider it.

45444 - Websdk controls should be seen as WebControl and respond to position and size as a regular control

Michel Bujardet Today at 10:56 AM
Is there any imperious reason why WebSDK controls are not behaving like other WebControls ?

When looking at controls with WebPage.ControlAtIndex, they are not seen. It appears it is not possible to reposition or resize them dynamically either. Or seen by WebAnimator.

Could you please make it so they are recognized as regular WebControls ?

<https://xojo.com/issue/45444>

I hope that it won’t add overhead, additional connections, and interference with our javascript files. On my side, the client interface is entirely made with the WebSdk and, mainly, javascript files. In this context, less the server is involved in my stuff, more I’m glad…

Any news?

Hi Oliver
Interesting choice to use websdk for all of your interface. May I ask why you went down this path? What was your objective? Was it worth it in the end to sacrifice the simplicity of using Xojo’s built in controls?

After a lot of digging I found I could add my SDK control to the xojo.controls array as a container by adding the following javascript in the setup JavascriptFramework event.

Return "new container('"+ me.ControlID + "',['Action']);"

I can now animate my custom control as I would any other control. I know the Xojo framework could change without warning but is this “safe” for now at least?

Hi Daniel,
Is it possible for you to show this in a simple example project?

TIA.
Andre

I cannot make this work for my WebSDK control. Yes, a simple example project would be greately appreciated!

/Stig

[quote=303269:@Daniel Wilson]After a lot of digging I found I could add my SDK control to the xojo.controls array as a container by adding the following javascript in the setup JavascriptFramework event.

Return "new container('"+ me.ControlID + "',['Action']);"

I can now animate my custom control as I would any other control. I know the Xojo framework could change without warning but is this “safe” for now at least?[/quote]
I would like to hear from an engineer if this is something we’re supposed to be doing, or something we should not do.
If this is a magical important thing to have in that Event Handler I might add it to WebGen

I may be able to get a sample up later. The trick is to put a dummy container control in your webpage. This loads the container web framework onto the browser.

Here’s a quick example created from the Three Stage Button WebSDK example.

SDK Control Example.zip

Note: Example created with Xojo2016r4

Please share any suggestions or enhancements for the benefit of all.

Some of the JavaScript for the WebAnimator framework is patent pending. Are there any licensing implications we need to be careful of?

[quote=303350:@Tim Parnell]I would like to hear from an engineer if this is something we’re supposed to be doing, or something we should not do.
If this is a magical important thing to have in that Event Handler I might add it to WebGen[/quote]
Yeah, don’t do that. You’re firing a constructor in our framework which in turn activates some dependencies that’ll most likely bite you down the road.

For instance… the object it creates has a certain expectation of what the DOM representation of a container looks like. If you don’t match it exactly, you’ll get JavaScript exceptions whenever one of those methods is called.

Thanks Daniel for your efforts, i will study your solution, although seeing the comment of Greg above i don’t know if this is the right way. But as long as there is no other suggestion from Greg or other member of the Xojo staff i don’t see another way to solve the problem.

Again thanks Daniel!

If you have concerns about licensing issues, please contact Customer Service at custserv@xojo.com.

Thank you Greg and Geoff for the information.

Andre, I am in the same position. Of course I take on board what Greg has said. I agree its a bad idea, but at present there is no other way to utilize the Impressive JavaScript behind the WebAnimator and its easy to use Xojo Methods. It would be really nice if the webSDK supported some sort of framework integration option out of the box.

I hope Michel will keep us updated on his feature request.

Could you clarify this statement? I’m not exactly sure what you’re asking for.

Apologies for the vague comment.

In my example project I chose the container constructor because from it’s framework.js file it looked fairly generic. The problem as you pointed out above, most of us developers don’t have a good understanding of how Xojo operates behind the scenes and are likely to break something!

I do not fully understand the complexity of what I am asking for, but all same, could you create a generic constructor that would add our custom controls to your framework? As I understand developers use the WebControlWrapper super to create custom WebSDK controls. It would be nice if those who wish to build their controls from scratch may continue doing so but those who would like to create a control without rewriting lots of JavaScript could select from a list of integration features such as WebAnimator support.

As far as I could tell the only thing preventing the WebAnimator from doing its work on my controls was that it couldn’t find my control on the xojo.controls array. After finding a way to add it to the xojo.controls array it worked fine.

As for Michel’s feature request, that may limit our fellow developers like Oliver. The event handler for FrameworkPropertyChanges is great but it would be nice if we had some code examples for cases such as:
*Left/Right positioning
*Height/Width
*Mouse events
*Keyboard events

Thanks again for you time and effort into this matter.

[thought I had something to say, but I don’t]

[quote=291374:@Michel Bujardet]Michel Bujardet Today at 10:56 AM
Is there any imperious reason why WebSDK controls are not behaving like other WebControls ?[/quote]
Well… when you put it like that…

We consider all web feature requests. Just remember, sometimes the answer is No.

[quote=291374:@Michel Bujardet]
45444 - Websdk controls should be seen as WebControl and respond to position and size as a regular control

When looking at controls with WebPage.ControlAtIndex, they are not seen. It appears it is not possible to reposition or resize them dynamically either. Or seen by WebAnimator.

Could you please make it so they are recognized as regular WebControls ?

<https://xojo.com/issue/45444>[/quote]
I took a moment to look at this case… and WebSDK controls are included in the controls returned by WebView.ControlAtIndex. I’ve attached a simple project to the case. If you can show me a sample project where they are not, I’d like to see that.

As far as repositioning or resizing them dynamically, WebControlWrappers receive an event named FrameworkPropertyChanged and it is up to the developer to see that the Left, Top, Width or Height properties have changed and to update the size if that’s something they want to allow. There are controls out there which would be completely broken if the user were allowed to resize them any which way and we don’t want to override that behavior.

That said, an option to opt-in to the client-side control list is not a bad idea.