call-object-handle :attribute :method
As an alternative to setting the PERSISTENT attribute, a procedure can be run persistently by setting the PROCEDURE-TYPE to "PERSISTENT". Regardless of which attribute is used, the other will automatically be set.
/* Get title of frame */ASSIGNhCall:IN-HANDLE = myframe_handlehCall:CALL-TYPE = GET-ATTR-CALL-TYPEhCall:CALL-NAME = "TITLE".hCall:INVOKE.Mytitle = hCall:RETURN-VALUE.The following fragment implements an ABL function, sleep, which causes the AVM to sleep for a specified number of milliseconds:
Invoking logic dynamically requires many more lines of code and is less efficient than invoking it statically. You typically use the call object when you cannot use the RUN statement, the DYNAMIC-FUNCTION() function, or widget:attribute or widget:method syntax, as in the following situations:
To invoke an internal or external procedure whose calling sequence (number of parameters and the data type of each) is unknown at compile time.
Note: If only the name of the procedure is unknown at compile time, use the RUN statement with the VALUE option—and avoid the call object altogether.
Note: If only the name of the function is unknown at compile time, use the DYNAMIC-FUNCTION() function—and avoid the call object altogether.If you already know the name of the attribute or procedure, you know its syntax, since the name implies certain syntax. And if you know the syntax, you know the calling sequence, since the syntax defines the calling sequence. And if you know the calling sequence, you can use widget:attribute or widget:method syntax—and avoid the call object altogether.
CREATE object-handle IN widget-pool
CREATE CALL hCall.
DELETE OBJECT handle.
DELETE OBJECT hCall.Since the call object, by default, goes into the SESSION widget pool, not into the closest unnamed widget pool, to delete a call object created when the IN widget-pool option is not used, use the DELETE OBJECT handle syntax explicitly.
Setting the PROCEDURE-TYPE attribute to "PERSISTENT" will automatically set the PERSISTENT attribute to TRUE. Likewise, setting the PERSISTENT attribute to TRUE will automatically set PROCEDURE-TYPE to "PERSISTENT". Setting the PROCEDURE-TYPE and PERSISTENT attributes to conflicting values, e.g., PERSISTENT as TRUE and PROCEDURE-TYPE as "SINGLE-RUN", will result in a run-time error.
© 2013 Progress Software Corporation and/or its subsidiaries or affiliates. |