Porovnávané verzie
porovnané s
Kľúč
- Tento riadok sa pridal
- Riadok je odstránený.
- Formátovanie sa zmenilo.
%OpenRefToObject function
Function
The function %OpenRefToObject asks the system for accessing Object Values which are defined with the Unique Identifier HOBJ.
Declaration
Blok kódu | ||||
---|---|---|---|---|
| ||||
BOOL %OpenRefToObject( HBJ in _hbj, BOOL in _bSynchro ) |
Parameters
_hbj | Value of the HBJ type or INT type. |
_bSynchro | Value of the Boolean type. |
Description
The function allows to ask the system for accessing Object Values which are defined with Unique Identifier HOBJ. The values are accessed to all ESL scripts which are interpreted in the actual process (the D2000 HI or D2000 EventHandler) by this function.
The using of this function is recommended in the case that the object (its HOBJ is mentioned when the function is called) is not directly in the script and the system do not know automatically, that Object Values are required for the script.
The using of this function is recommended in the case that the object (its HOBJ is mentioned when the function is called) is not directly in the script and the system do not know automatically, that Object Values are required for the script.
Example
If the User Tag U.Test (value type Integer) has HOBJ 1234 then the following script will generate the run-time error (_ERR_OBJECT_NOT_FOUND) or the local variable _val will be incorrect:
Blok kódu | ||||
---|---|---|---|---|
| ||||
INT _val ALIAS _a SET_a AS (1234) ; incorrect row _val:= _a |
The user can avoid this status by using this function %OpenRefToObject(IN HBJ _hbj, IN BOOL _bSynchro):
Blok kódu | ||||
---|---|---|---|---|
| ||||
BOOL _openOk INT _val ALIAS _a SET _a AS (1234) _openOk:= %OpenRefToObject(_a\HBJ,@TRUE) IF _openOk THEN ;the row is correct _val:= _a ELSE ;an object with HOBJ 1234 does not exist !!! ENDIF |
The parameter _bSynchro is set on @TRUE. This setting allows to check through the return value of the function if the object with the required HOBJ exists. The first calling of the function in actual process communicates with the process D2000 Server process synchronously. The existence of the object is checked. This activity can run some time. If the object exists then next calling is quick.
If the parameter is set on @FALSE the script will send the request for opening the object and will proceed. The return value of the function is @TRUE and that is why it is not possible to check the existence of the object with defined HOBJ.
Note
If the script do not ask for Object Value the system is informed by the function %CloseRefToObject.