Xojo 2021 r3.1:
I’m having issues with WebSDKUIControls not updating on the browser (chrome, firefox, edge… doesn’t matter which one) unless I click away (change focus) and then back on the page from the browser side.
The control’s properties are being updated on the app side through a HandleURL event, then destroyed/recreated but the changes are not always being displayed browser side.
I’m trying to make this work over multiple sessions and it has proven very inconsistent.
First time sending the data to the app, the control in focus won’t update until the page’s focus is lost and regained or the other session’s control is updated and not the one in focus. This generally keeps happening until I refresh the browsers for all sessions and then works as expected (updates quick, for all sessions, no weird behavior)?
I have tried the following after recreating and updating the values of the control and have had no change:
I would think the problem could be in the render() event in the javascript side of the plugin.
I’ve never experimented such updating error in the xojo side.
be careful also to send very strict utf8 strings or json items from xojo to the browser, this can lead to tricky results…
I had been thinking the same with the javascript event. I realized that when controls load for the first time, the render() and updateControl() part of the javascript runs.
However, if I delete the control and recreate it or just change the image property of it via javascript, these methods are not called again.
As a follow up to this post,
I had created a simple project with the VisualControls on a WebContainer (WebPage works too) to test this and it works perfectly with receiving HandleURL calls. All VisualControls update across all sessions.
Adding this exact code that works fine to a large project, and the VisualControls no longer update correctly. Usually, if no browsers are in focus then nothing updates until one is clicked on and it will change for one browser and not the other (.UpdateBrowser() doesn’t work).
I have been working on this issue for over a week and can’t work out why this doesn’t work as expected. At this stage, I’m just hoping that it’s somehow fixed in the next version of Xojo.
This sounds like some sort of timing issue. Could you post a link to your simplified project so that we might see if there’s something that jumps out at us?
I have been testing this app with having mutliple tabs of Chrome open.
That’s going to cause you trouble right there. Because we use a session cookie and cookies for the same site are shared among all open tabs, they’ll all be seen as the same session by the app itself.
In my cut-down example project using different browsers/sessions, this works fine.
However, I’ve worked out the issue… I’m led to believe that my large project is not updating over multiple sessions because the WebContainers are being embedded onto a webpage from a dictionary. This displays fine but is bugging out when receiving data as described in my post.
Change my project for WebContainers being ‘manually’ embedded and it all works fine.