Consultor Eletrônico



Kbase 21075: ADM: Errors 5705, 2125 Using SmartObjects on Different Pages
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/16/2008
Status: Unverified

FACT(s) (Environment):

Progress 9.x

SYMPTOM(s):

ADM2

Could not evaluate procedure handle expression while trying to execute <internal-procedure>. (2125)

FUNCTION function given invalid or Unknown context to run IN. (5705)

Using SmartObjects in different pages and executing an internal procedure or dynamic function in these SmartObjects, you might see errors 5705 and 2125.

CAUSE:

The adm-create-objects internal procedure in the SmartContainers  creates the SmartObjects by executing the 'constructObject' procedure.

   RUN constructObject (INPUT  'dcust.w DB-AWARE':U,
        INPUT  FRAME fMain:HANDLE,
        INPUT  <instance properties>,
        OUTPUT h_dcust).
  RUN repositionObject IN h_dcust ( 1,71 , 6,00 ) NO-ERROR.

The OUTPUT parameter in the constructObject procedure is the handle value for the created object.

In adm-create-objects, the SmartObject is created according to the page number.  The following is the initial code of the adm-create-objects procedure:

   DEFINE VARIABLE currentPage AS INTEGER NO-UNDO.

    ASSIGN currentPage = getCurrentPage().

    CASE currentPage:
    WHEN 0 THEN
DO:
        /* Run constructObject for SMO in page 0 */
      END.
      WHEN 1 THEN
DO:
            /* Run constructObject for SMO in page 1 */
      END.
    END CASE.

According to this code, when the container is initialized, just the SmartObject on page 0 (zero) will be initialized.  Therefore, when executing procedures or dynamic functions before selecting the page where the SmartObject resides, the errors mentioned above will appear because the object is not instantiated and the handle is invalid.

When another page is selected, the internal procedure 'changePage' is executed in the super procedure, containr.p.  ChangePage executes 'createObject' in containr.p too, and this procedure executes adm-create-object in TARGET-PROCEDURE.  Therefore the adm-create-object in the container will be executed again, and the SmartObject in the new page will be instantiated.

FIX:

Adding the option, NO-ERROR, at the end of the RUN or DYNAMIC-FUNCTION statements gets rid of the error messages but the process will not be executed.

A way to solve this problem is to override the selectPage procedure in the SmartContainer and execute the procedure or dynamic-function according to the selected page.