Three years ago, bug #66497 was reported.
This bug hits a basic aspect of Xojo: controls on a webpage fire their opening events before the page’s constructor method fires. To work around this, you have to move code to the controls’ Shown event, which is far from ideal. This approach delays loading until the page is visible, resulting in a jarring user experience with a double reload. If the page is complex enough it can fire after the user startes to enter data.
We haven’t found a way to work around this.
Xojo acknowledged and verified the bug promptly three years ago.
Two years ago, a bot tagged it as “Web,” but no progress was made for on this bug in the 3 years.
The bug has undergone numerous milestone reassignments (Suggesting it meet the criteria to be fixed?):
• 1st milestone reassignment: 2023r2
• 2nd milestone reassignment: 2023r3
• 3rd milestone reassignment: 2023r4 (on then off then on again)
• 4th milestone reassignment: 2024r1
• 5th milestone reassignment: 2024r2
• 6th milestone reassignment: 2024r3
• 7th milestone reassignment: 2024r4
• 8th milestone reassignment: 2025r1
1 Like
Does anyone hav a suggest for a work around for this?
If it’s just to avoid some flickering because Shown will happen too late, a Computed Property will work just fine. In this example it will be executed before the page is shown.
WebPageConstructorAlternative.xojo_binary_project.zip (9.8 KB)
Or just having a method with some parameters to initialize the page. The key is to change the properties or call to any required method before calling WebPage.Show
.
Another example using a Shared Method:
AnotherWebPageConstructorAlternative.xojo_binary_project.zip (9.8 KB)
Thanks, Ricardo!
We looked at approach like this a couple of years back. But it is not practical.
I think this means we’re going to have to add a line of code for every single control. And logic to handle setting the different kinds of Controls text fields, pop-ups, check boxes, etc? We literally have dozens of pages with thousands of Controls. And if I’m dealing in container, Controls – – that adds another level of complexity.
Or am I missing something?
As far I understand, you want to pass some parameters to the page Constructor.
Var test As New ExampleWebPage("foo", "bar", "baz")
The second example shows a way to do it like this instead:
Var test As ExampleWebPage = ExampleWebPage.Initialize("foo", "bar", "baz")
The code to use those parameters can live inside this Initialize method, instead of the Constructor.
Looks like you just fixed the bug! Nice work. I can’t wait to get the next release and benefit from your work.
1 Like