Type | Description | |||
EventID as Long | A Long expression that specifies the identifier of the event. Use the EventParam(-2) to display entire information about fired event ( such as name, identifier, and properties ). |
This is useful for X++ language, which does not support event with parameters passed by reference.
In X++ the "Error executing code: FormActiveXControl (data source), method ... called with invalid parameters" occurs when handling events that have parameters passed by reference. Passed by reference, means that in the event handler, you can change the value for that parameter, and so the control will takes the new value, and use it. The X++ is NOT able to handle properly events with parameters by reference, so we have the solution.The solution is using and handling the Event notification and EventParam method., instead handling the event that gives the "invalid parameters" error executing code.
Let's presume that we need to handle the BarParentChange event to change the _Cancel parameter from false to true, which fires the "Error executing code: FormActiveXControl (data source), method onEvent_BarParentChange called with invalid parameters." We need to know the identifier of the BarParentChange event ( each event has an unique identifier and it is static, defined in the control's type library ). If you are not familiar with what a type library means just handle the Event of the control as follows:
// Notifies the application once the control fires an event. void onEvent_Event(int _EventID) { print exhtml1.EventParam(-2).toString(); }
This code allows you to display the information for each event of the control being fired as in the list bellow:
MouseMove/-606( 0 , 0 , 63 , 9 ) MouseUp/-607( 1 , 0 , 63 , 8 ) SelChange/2 DblClick/-601( 0 , 63 , 8 ) Click/-600 MouseUp/-607( 1 , 0 , 63 , 8 ) SelChange/2 MouseDown/-605( 1 , 0 , 63 , 8 ) MouseMove/-606( 0 , 0 , 63 , 8 )
Each line indicates an event, and the following information is provided: the name of the event, its identifier, and the list of parameters being passed to the event. The parameters that starts with = character, indicates a parameter by reference, in other words one that can changed during the event handler.
Syntax for Event event, /NET version, on:
private void Event(object sender,int EventID) { } Private Sub Event(ByVal sender As System.Object,ByVal EventID As Integer) Handles Event End Sub |
private void Event(object sender, AxEXHTMLLib._IHTMLEvents_EventEvent e) { } void OnEvent(long EventID) { } void __fastcall Event(TObject *Sender,long EventID) { } procedure Event(ASender: TObject; EventID : Integer); begin end; procedure Event(sender: System.Object; e: AxEXHTMLLib._IHTMLEvents_EventEvent); begin end; begin event Event(long EventID) end event Event Private Sub Event(ByVal sender As System.Object, ByVal e As AxEXHTMLLib._IHTMLEvents_EventEvent) Handles Event End Sub Private Sub Event(ByVal EventID As Long) End Sub Private Sub Event(ByVal EventID As Long) End Sub LPARAMETERS EventID PROCEDURE OnEvent(oHTML,EventID) RETURN |
<SCRIPT EVENT="Event(EventID)" LANGUAGE="JScript"> </SCRIPT> <SCRIPT LANGUAGE="VBScript"> Function Event(EventID) End Function </SCRIPT> Procedure OnComEvent Integer llEventID Forward Send OnComEvent llEventID End_Procedure METHOD OCX_Event(EventID) CLASS MainDialog RETURN NIL void onEvent_Event(int _EventID) { } function Event as v (EventID as N) end function function nativeObject_Event(EventID) return |