Create a event-object programmatic

Is it possible to create a event-object programmatic?
I want to call a function who expect a event as parameter from my code.

Hi Gabriel,

As far as I know you can’t create your own JSEvent object.
I suggest you file a feature request.

Depending on what you want to do, you could simulate it, creating a JavaScript Object with similar properties and methods.
Of course it would not return true to a test of instanceof JSEvent, but it might do the trick if all you want to do is to pass a few information to a target method.
Not sure I would recommend that though, but it all depends on what you are doing.

my first question is: what is the usecase?
Why do you want to call an event method by your own (business?) code?

I was looking for this the other day as well and it was while attempting to try and conform to the correct inputs of an existing event method that I wanted to call programatically. No functional reason I can think of in my case – more of a best practices interest.

I like to call a method of the Servoy Framework that expect a event as parameter.
The method evaluate the getElementName() and getFormName() from the event.
Normally, the method will be called from a button on a form, but I like to call this method from a formmethod and on this point I dont have a event.

Hi Gabriel,

Is this form method of yours triggered by another button/event?
If this is also the form/element that you want the framework method to use you can simply pass the JSEvent object from your original button/event to the framework method.

Hope this helps.