OPENEVENT action


Function
The action opens and runs given Server Event or Client and Server Event.
Declaration
OPENEVENT refToServerEvent DIRECT [INSTANCE instanceExprInt] [SYNC]
 
or
 
OPENEVENT refToServerEvent ON procIdent [INSTANCE instanceExprInt] [SYNC]
Parameters
refToServerEventinReference to server event or Client and Server Event.
instanceExprIntinExpression of Int type - instance number.
procIdentinIdentifier of object of Process type (D2000 HI or D2000 EventHandler).
Description
The action opens and runs the Server Event or Client and Server Event (refToServerEvent) within the D2000 HI or D2000 Event Handler processes given by the parameter procIDent.
Client and Server Event can be opened and running only within the D2000 HI, given by the parameter procIDent.

The action also allows to specify an instance number (the instanceExprInt parameter) for multiple opening of the server event within the process.

If the keyword SYNC is used, the action will be terminated after the event has been really open. After the action is terminated, RPC procedures may be called to the event.
 
 INT _hbj     ; a unique identifier process
 
 TEXT _desc
 ;
 OPENEVENT E.Lib1 ON (_hbj) SYNC
 ; calling
 CALL [E.Lib1] GetDesc(_desc) ON (_hbj) 
 
The action ends with error, if there is the key word SYNC and:
  • E.Lib1 event is neither Server Event nor Client and Server Event,
  • E.Lib1 event is Server Event but the process, specified by the prameter _hbj, is not D2000 HI or D2000 Event Handler or the given process is not running,
  • E.Lib1 event is Client and Server Event and the process, specified by the parameter _hbj, is not D2000 HI, or the given process is not running.
The action will not be successful if requires the opening the event instance on the process D2000 Event Handler, which is the parent of the E.Lib1 event.

Action with the DIRECT clause opens given event within the same process that contains the script with the OPENEVENT action.

Closing an server event opened by OPENEVENT must be required by given script - calling the CLOSE DIRECT action. It can me implemented by the following RPC procedure:
 
 RPC PROCEDURE Close (TEXT _desc)
   CLOSE DIRECT
 END
 
WARNING: The RPC procedure Close must be called asynchronously, i.e.:
 
 CALL E.Lib1 Close (_desc) ASYNC ON (_hbj) 
Note
The change in the event configuration while running the script does not influence the run.

Related pages:

Napíšte komentár