I feel like I’m missing something simple, but I can’t get AddHandler to work for a WebTimer. The details and example project are in my comment at <https://xojo.com/issue/15903>.
I added a class and set it’s super to WebPage. On Open, I assign a new WebTimer to a property, set it’s properties and use AddHandler for its action. This WebTimer is meant to raise an AdjustControls event. I then created a new WebPage and set its super to my base class.
When I later set the mode of the WebTimer to ModeSingle, nothing happens. The method that is supposed to handle Action just doesn’t fire. If I try to call Reset after I set the mode, I get a JavaScript error.
Dragging a WebTimer to the page and setting its Action event works just fine.
Bug or have a done something silly?
It turns out that AddHandler isn’t needed. If I create WebTimer subclass with an Action and assign it as a property to the base page, I get the same result.
The second project is in that Feedback report too.
In Xojo Web, the WebTimer is a JavaScript timer. The reported error
[quote]Could not execute returned javascript: Unable to get property ‘setup’ of undefined or null reference
Source: Xojo.controls[‘I4WwiSX6’].setup(1,1000);[/quote]
Simply means the control does not exist. It is quite possible putting a control in Super does not bring it to the DOM.
I would use a server-side timer instead. It does not require being present in the DOM.
My solution was to drag a WebTimer onto the page and assign it to the super’s property. That’s an adequate workaround for now, but I think this should work as intended. We’ll see what the engineers have to say.