property G2antt.EventParam(Parameter as Long) as Variant
Retrieves or sets a value that indicates the current's event parameter.

 TypeDescription 
   Parameter as Long A long expression that indicates the index of the parameter being requested ie 0 means the first parameter, 1 means the second, and so on. If -1 is used the EventParam property retrieves the number of parameters. If -2, the EventParam gives full information about the event, such as name, identifier, and parameters.  Accessing an not-existing parameter produces an OLE error, such as invalid pointer ( E_POINTER )   
   Variant A VARIANT expression that specifies the parameter's value.  
The EventParam method is provided to allow changing the event's parameters passed by reference, even if your environment does not support changing it ( uniPaas 1.5 (formerly known as eDeveloper), DBase, and so on ). For instance,  Unipaas event-handling logic cannot update ActiveX control variables by updating the received arguments. The EventParam(0) retrieves the value of the first parameter of the event, while the EventParam(1) = 0, changes the value of the second parameter to 0 ( the operation is successfully, only if the parameter is passed by reference ). The EventParam(-1) retrieves the number of the parameters of the current event.

Let's take the event "event KeyDown (KeyCode as Integer, ByVal Shift as Integer)", where the KeyCode parameter is passed by reference. For instance, put the KeyCode parameter on 0, and the arrow keys are disabled while the control has the focus. 

In most languages you will type something like:

Private Sub Control1_KeyDown(KeyCode As Integer, Shift As Integer)
    KeyCode = 0
End Sub

In case your environment does not support events with parameters by reference, you can use a code like follows:

Private Sub Control1_KeyDown(KeyCode As Integer, Shift As Integer)
    Control1.EventParam(0) = 0
End Sub

In other words, the EventParam property provides the parameters of the current event for reading or writing access, even if your environment does not allow changing parameters by reference.

Calling the EventParam property outside of an event produces an OLE error, such as pointer invalid, as its scope was designed to be used only during events.


Send comments on this topic.
1999-2017 Exontrol.COM, Software. All rights reserved.