I’m working on a subclasses of the built-in WE controls. Now I want to implement certain events that are not yet there. On the JS side I suppose I’d have to catch the events using event listeners. But how can I further proceed within Xojo, given the fact that the “ExecuteEvent” Event is WebControlWrapper only (which I am not using here)?
If you are using the native WE controls, implementing a new event is a simple as adding an Event Definition to the subclassed control (e.g. MyNewEvent) and then using
In my particular case, I want to subclass the Weblistbox and adding the possibility to have checkboxes in a cell. Cells can be altered using the .innerHTML property, so that’s not the problem. Rather tricky, I need to catch the “Change” event when a user checks/unchecks the checkbox. In JS I’d catch the “onChange” event, send it to the App using “Xojo.triggerServerEvent” but I cannot catch it from there?
Ah, sorry. You didn’t indicate exactly what you were trying to do. That’s beyond my knowledge.
You might want to check out the Taylor Design WebControls at http://webcustomcontrols.com. Not sure if he’s got checkboxes working in his WebListbox but if not, I’d contact him to see what he thinks on how hard it is to add.
Anyone know how to do this?
Would be awesome if they would could get the .TriggerEvent method to be used and ‘userdata’ passed to a custom ‘Event Definition’.
I’m wondering if this could be implemented with a single WebCustomControl and some introspection… Granted the framework should really support something like this.
I’m researching what I can break now, actually… we’ll see.
Don’t let Greg hear you say that…
If you hack, you are responsible for your hacks. But what are you actually trying to accomplish? Sounds like you’re going down a road you don’t have to go down.
Hahaha… in a way that doesn’t edit or change the framework, of course.
documentControlHere.addEventListener(‘touchstart’, someXojoFunction(), false);
But I want to the someXojoFunction() to be one that raises a custom event on the subClassed Control.
Currently only the WebControlWrapper has a way to support this but I want to add events to regular controls.
I am not sure, and may be I’m too late, but can’t you somehow implement Xojo.triggerServerEvent? Which allows you to define event on your choice and use the same event handler with select case and passes array of params from the page, called one.
You can find usage in WebControlWrapper SDK manual. It’s in the EXTRAS folder.
Do you know are there any plans to add “ExecuteEvent” on the built in controls like the WebControlWrapper? This would make it really easy to add additional events to the built in controls. I mean we can always create a WebControlWrapper that ends up wrapping to another control on the page but this is a lot more work to implement.
There are no plans to do this at this time, however you could file a feature request.
I added a feature request if anyone would like to put some points down.
I definitely wish we could support more than 5 cases… 5 per category seems more adequate.