Ole4D Methods

OCSetEventHandler(p_Area;p_Event;p_Method;p_MemSize )


Associates a 4D method to an event of an Ole object. When the event occurs, the 4D method that is associated to the event is called.
Each time the event occurs, there is created a new 4D process in which the 4D method is executed.
Except the case when you want to set the value of event parameters, it is recommended to use instead the OCSetAsynchHandler command.
The event handlers assigned using this command must take as less time as possible.This is because while the event is processed, the 4D process containing the plug-in does not run.

Parameters
Parameter Type   Description
p_Area Longint -> Variable of the plug-in area.
p_Event String -> Name of the ole object event for which the handler is set.
p_Method String -> Name of the method to call in case this event occurs.
This must be a method that takes one parameter. The parameter is of String type and it is used by the plug-in to identify an event.
Script host of the event contains parameters of the event and the object of the event.
p_MemSize Longint -> The amount of memory allocated for the new created process, expressed in bytes.


Return Values
0 – The method call was successful.
If the method call was not successful the return value is non zero. For more information call OCLastError.

Example
$i := OCSetEventHandler(OCONT1,”NodeClick”,”OnNodeClick”)
`do some processing……………………
$i := OCRemoveHandler(OCONT1,”NodeClick”)


See Also
OCRemoveHandler , Write event handlers