new JSEvent Object - cannot set properties

I am calling a function that is linked to the onAction of a button element. Since this method is dependent upon an event to get the form name, element name etc, I am creating a new JSEvent object and passing it to the function.

I tried to add the form and element name directly to the object with something like, event.setFormName or event.form = myFormName. This would allow me to use the Servoys native commands to retrieve this value from the object. The only way I could find to do this was to use the event.data object. This will work, but adds additional code in the receiving method to use the actual event properties or the event data object.

Is there another way to populate the properties in the native event object?

Here is the code using the data object.

//queue click on button
var _newEvent = new JSEvent();
_newEvent.data = new Object();
_newEvent.data.formName = _form;
newEvent.data.elementName = _associatedButton;
globals.comm_popup_openPopup(_newEvent)

Thanks in advance,

Lenore

+1
I would love to see such feature, so that we can build or own, JSEvent Object…

+1 vote from me. Great idea.

try this:

    //queue click on button
    var _newEvent = new Object();
    _newEvent.data = new Object();
    _newEvent.formName = _form;
    newEvent.elementName = _associatedButton;
    globals.comm_popup_openPopup(_newEvent)

that will behave the same as a JSEvent object it self.

currently we dont support updating values of the jsevent object they are readonly (except data)

they should be readonly because strange unexpected things can happen if scripts can just change them (if you pass the event object around)
Better would then to have something like

var event = new JSEvent(formname,elementname,xxx)