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 exgantt1.EventParam(-2).toString(); }
This code allows you to display the information for each event of the control being fired as in the list bellow:
MouseDown/-605( 1 , 0 , 102 , 644 ) SelChange/2 MouseMove/-606( 1 , 0 , 105 , 646 ) MouseUp/-607( 1 , 0 , 128 , 682 ) Click/-600Syntax 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, AxEXEDITLib._IShellViewEvents_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: AxEXEDITLib._IShellViewEvents_EventEvent); begin end; begin event Event(long EventID) end event Event Private Sub Event(ByVal sender As System.Object, ByVal e As AxEXEDITLib._IShellViewEvents_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(oShellView,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 |