Release 10.1A: OpenEdge Development:
ADM and SmartObjects

> ## Standard class files

> The container class has the following standard class files, located in the `%DLC%\src\adm2` (Windows) or `$DLC/src/adm2` (UNIX) directory:

> - containr.i: primary include file.

> - cntnprop.i: property file.

> - containr.p: super procedure file.

> - cntnprto.i: prototype file.

> The containr.i primary include file follows:

> containr.i
>     &ANALYZE-SUSPEND _VERSION-NUMBER AB_v9r12
>     &ANALYZE-RESUME
>     &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Method-Library
>     /*-------------------------------------------------------------------------
>         Library     : containr.i
>         Purpose     : Default V9 Main Block code and Method Procedures
>                       for ADM Container procedures.

>         Syntax      : {src/adm2/containr.i}

>         Modified    : May 19, 1999 Version 9.1A
>     -------------------------------------------------------------------------*/
>     /***********************  DEFINITIONS  ***********************************/
>     &IF "{&ADMClass}":U = "":U &THEN
>       &GLOB ADMClass containr
>     &ENDIF
>     &IF "{&ADMClass}":U = "containr":U &THEN
>       {src/adm2/cntnprop.i}
>     &ENDIF
>     /* _UIB-CODE-BLOCK-END */
>     &ANALYZE-RESUME
>     &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
>     /* ********************  Preprocessor Definitions  ******************** */
>     /* _UIB-PREPROCESSOR-BLOCK-END */
>     &ANALYZE-RESUME
>     /* *********************** Procedure Settings ************************ */
>     &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
>     /* Settings for THIS-PROCEDURE
>        Type: Method-Library
>        Allow:
>        Frames: 0
>        Add Fields to: Neither
>        Other Settings: INCLUDE-ONLY
>      */
>     &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
>     /* *************************  Create Window  ************************** */
>     &ANALYZE-SUSPEND _CREATE-WINDOW
>     /* DESIGN Window definition (used by the UIB)
>       CREATE WINDOW Method-Library ASSIGN
>              HEIGHT             = 8
>              WIDTH              = 60.
>     /* END WINDOW DEFINITION */
>     */
>     &ANALYZE-RESUME
>     &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Method-Library
>     /* ************************* Included-Libraries *********************** */
>     {src/adm2/visual.i}
>     /* _UIB-CODE-BLOCK-END */
>     &ANALYZE-RESUME
>     &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Method-Library
>     /* ***************************  Main Block  *************************** */
>       RUN start-super-proc("adm2/containr.p":U).
>     /* Best default for GUI applications - this will apply to the whole session: */
>     PAUSE 0 BEFORE-HIDE.
>       /* _ADM-CODE-BLOCK-START _CUSTOM _INCLUDED-LIB-CUSTOM CUSTOM */
>       {src/adm2/custom/containrcustom.i}
>       /* _ADM-CODE-BLOCK-END */
>     /* _UIB-CODE-BLOCK-END */
>     &ANALYZE-RESUME

> The cntnprop.i property file follows:

> cntnprop.i
>     &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
>     &ANALYZE-RESUME
>     &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Include
>     /*-------------------------------------------------------------------------
>         File        : cntnprop.i
>         Purpose     : Starts containr.p super procedure and defines general
>                       SmartContainer properties and other values.
>         Syntax      : {src/adm2/cntnprop.i}

>         Description :

>         Modified    : May 19, 1999 Version 9.1A
>       ------------------------------------------------------------------------*/
>     /*          This .W file was created with the Progress UIB.             */
>     /*----------------------------------------------------------------------*/
>     /* ***************************  Definitions  ************************** */
>       {src/adm2/custom/containrdefscustom.i}
>     /* _UIB-CODE-BLOCK-END */
>     &ANALYZE-RESUME
>     &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
>     /* ********************  Preprocessor Definitions  ******************** */
>     /* _UIB-PREPROCESSOR-BLOCK-END */
>     &ANALYZE-RESUME
>     /* *********************** Procedure Settings ************************ */
>     &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
>     /* Settings for THIS-PROCEDURE
>        Type: Include
>        Allow:
>        Frames: 0
>        Add Fields to: Neither
>        Other Settings: INCLUDE-ONLY
>      */
>     &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
>     /* *************************  Create Window  ************************** */
>     &ANALYZE-SUSPEND _CREATE-WINDOW
>     /* DESIGN Window definition (used by the UIB)
>       CREATE WINDOW Include ASSIGN
>              HEIGHT             = 8
>              WIDTH              = 60.
>     /* END WINDOW DEFINITION */
>     */
>     &ANALYZE-RESUME
>     &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Include
>     /* ***************************  Main Block  *************************** */
>       /* Include the file which defines prototypes for all of the super
>          procedure’s entry points. Also, start or attach to the super procedure.
>          Skip start-super-proc if we *are* the super procedure.
>          And skip including the prototypes if we are *any* super procedure. */
>     &IF "{&ADMSuper}":U EQ "":U &THEN
>       {src/adm2/cntnprto.i}
>     &ENDIF
>       /* Preprocs to identify to compiler which properties are in the temp-table.*/
>       &GLOB xpCurrentPage
>       &GLOB xpContainerTarget
>       &GLOB xpContainerTargetEvents
>       &GLOB xpPageNTarget
>       &GLOB xpPageSource
>       &GLOB xpFilterSource
>       &GLOB xpDataTarget
>       &GLOB xpUpdateSource
>       &GLOB xpUpdateTarget
>       &GLOB xpStartPage
>       &GLOB xpRunMultiple
>       /* Now include the next-level-up property include file. This builds up
>          the property temp-table definition,
>          which we will then add our field definitions to. */
>         {src/adm2/visprop.i}
>     &IF "{&ADMSuper}":U = "":U &THEN
>       ghADMProps:ADD-NEW-FIELD(’CurrentPage’:U, ’INT’:U, 0, ?, 0).
>       ghADMProps:ADD-NEW-FIELD(’ContainerTarget’:U, ’CHAR’:U, 0, ?, ’’:U).
>       ghADMProps:ADD-NEW-FIELD(’ContainerTargetEvents’:U, ’CHAR’:U, 0, ?,
>         ’exitObject’:U).
>       ghADMProps:ADD-NEW-FIELD(’PageNTarget’:U, ’CHAR’:U, 0, ?, ’’:U).
>       ghADMProps:ADD-NEW-FIELD(’PageSource’:U, ’HANDLE’:U).
>       ghADMProps:ADD-NEW-FIELD(’FilterSource’:U, ’HANDLE’:U).
>       ghADMProps:ADD-NEW-FIELD(’DataTarget’:U, ’CHAR’:U, 0, ?, ’’:U).
>       ghADMProps:ADD-NEW-FIELD(’UpdateSource’:U, ’HANDLE’:U).
>       ghADMProps:ADD-NEW-FIELD(’UpdateTarget’:U, ’CHAR’:U, 0, ?, ’’:U).
>       ghADMProps:ADD-NEW-FIELD(’StartPage’:U, ’INT’:U, 0, ?, ?).
>       ghADMProps:ADD-NEW-FIELD(’RunMultiple’:U, ’LOGICAL’:U, 0, ?, NO).
>     &ENDIF
>       {src/adm2/custom/cntnpropcustom.i}
>     /* _UIB-CODE-BLOCK-END */
>     &ANALYZE-RESUME

> An abridged version of the containr.p super procedure file follows; the complete file is quite long):

> containr.p
>     &ANALYZE-SUSPEND _VERSION-NUMBER AB_v9r12
>     &ANALYZE-RESUME
>     &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
>     /*-------------------------------------------------------------------------
>         File        : containr.p
>         Purpose     : Code common to all containers, including WIndows and Frames

>         Syntax      : adm2/containr.p

>         Modified    : July 22, 1999 Version 9.1A
>       ------------------------------------------------------------------------*/
>     /*          This .W file was created with the Progress UIB.             */
>     /*----------------------------------------------------------------------*/
>     /* ***************************  Definitions  ************************** */
>     /* Tell cntnattr.i that this is the Super Procedure */
>     &SCOP ADMSuper containr.p
>       {src/adm2/custom/containrexclcustom.i}
>     DEFINE VARIABLE giPrevPage AS INTEGER NO-UNDO.
>     /* _UIB-CODE-BLOCK-END */
>     &ANALYZE-RESUME
>     &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
>     /* ********************  Preprocessor Definitions  ******************** */
>     &Scoped-define PROCEDURE-TYPE Procedure
>     &Scoped-define DB-AWARE no
>     /* _UIB-PREPROCESSOR-BLOCK-END */
>     &ANALYZE-RESUME
>     /* ************************  Function Prototypes ********************** */
>     &IF DEFINED(EXCLUDE-getContainerTarget) = 0 &THEN
>     &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD getContainerTarget
>     Procedure
>     FUNCTION getContainerTarget RETURNS CHARACTER
>       (  )  FORWARD.
>     /* _UIB-CODE-BLOCK-END */
>     &ANALYZE-RESUME
>     &ENDIF
>     .
>     .
>     .
>     [Similar prototypes for the following functions:
>         getContainerTargetEvents    pageNTargets
>         getCurrentPage              setContainerTarget
>         getDataTarget               setDataTarget
>         getFilterSource             setFilterSource
>         getPageNTarget              setPageNTarget
>         getPageSource               setPageSource
>         getRunMultiple              setRunMultiple
>         getUpdateSource             setUpdateSource
>         getUpdateTarget             setUpdateTarget]
>     .
>     .
>     .
>     /* *********************** Procedure Settings ************************ */
>     &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
>     /* Settings for THIS-PROCEDURE
>        Type: Procedure
>        Allow:
>        Frames: 0
>        Add Fields to: Neither
>        Other Settings: CODE-ONLY COMPILE
>      */
>     &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
>     /* *************************  Create Window  ************************** */
>     &ANALYZE-SUSPEND _CREATE-WINDOW
>     /* DESIGN Window definition (used by the UIB)
>       CREATE WINDOW Procedure ASSIGN
>              HEIGHT             = 15
>              WIDTH              = 60.
>     /* END WINDOW DEFINITION */
>                                                                             */
>     &ANALYZE-RESUME
>     &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
>     /* ************************* Included-Libraries *********************** */
>     {src/adm2/cntnprop.i}
>     /* _UIB-CODE-BLOCK-END */
>     &ANALYZE-RESUME
>     &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
>     /* ***************************  Main Block  *************************** */
>     /* _UIB-CODE-BLOCK-END */
>     &ANALYZE-RESUME
>     /* **********************  Internal Procedures  *********************** */
>     &IF DEFINED(EXCLUDE-assignPageProperty) = 0 &THEN
>     &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE assignPageProperty Procedure
>     PROCEDURE assignPageProperty :
>     /*-------------------------------------------------------------------------
>       Purpose:  Sets the specified property in all objects on the CurrentPage of
>                 calling SmartContainer.
>        Params:  INPUT pcProp AS CHARACTER -- property to set.
>                 INPUT pcValue AS CHARACTER -- value to assign to that property.
>                     This is specified in CHARACTER form but can be used to
>                     assign values to non-character properties.
>         Notes:  This variation on assignLinkProperty is necessary because
>                 the notion of paging does not fit well with PUBLISH/SUBSCRIBE.
>                 All objects in a Container will subscribe to initializeObject, etc.,
>                   but the paging performs the operation on subsets of those objects
>      at a time. That is, the container will not publish ’iniializeObject’
>                 to objects on a page other than zero until that page is first
>                 viewed.  So properties such as HideOnInit which are set as part
>                 of initialization must be set page-by-page.

>     --------------------------------------------------------------------------/
>       DEFINE INPUT PARAMETER pcProp  AS CHARACTER NO-UNDO.
>       DEFINE INPUT PARAMETER pcValue AS CHARACTER NO-UNDO.

>       DEFINE VARIABLE iVar     AS INTEGER   NO-UNDO.
>       DEFINE VARIABLE cObjects AS CHARACTER NO-UNDO.

>       {get CurrentPage iVar}.
>       cObjects = pageNTargets(TARGET-PROCEDURE, iVar).

>       DO iVar = 1 TO NUM-ENTRIES(cObjects):
>         dynamic-function("set":U + pcProp IN WIDGET-HANDLE(ENTRY(iVar, cObjects)),
>           pcValue) NO-ERROR.
>       END.
>       RETURN.
>     END PROCEDURE.
>     /* _UIB-CODE-BLOCK-END */
>     &ANALYZE-RESUME
>     &ENDIF
>     .
>     .
>     .
>     [Similar code for the following procedures:
>         changePage          initPages
>         confirmExit         notifyPage
>         constructObject     passThrough
>         createObjects       removePageNTarget
>         deletePage          selectPage
>         initializeObject    viewObject
>                             viewPage]
>     /* ************************  Function Implementations ***************** */
>     &IF DEFINED(EXCLUDE-getContainerTarget) = 0 &THEN
>     &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION getContainerTarget Procedure
>     FUNCTION getContainerTarget RETURNS CHARACTER
>       (  ) :
>     /*-------------------------------------------------------------------------
>       Purpose:  Returns a list of the handles of the object’s contained objects.
>        Params:  <none>
>     --------------------------------------------------------------------------/
>       DEFINE VARIABLE cTarget AS CHARACTER NO-UNDO.
>       {get ContainerTarget cTarget}.
>       RETURN cTarget.
>     END FUNCTION.
>     /* _UIB-CODE-BLOCK-END */
>     &ANALYZE-RESUME
>     &ENDIF
>     [Similar code for the following functions:
>         getContainerTargetEvents    pageNTargets
>         getCurrentPage              setContainerTarget
>         getDataTarget               setDataTarget
>         getFilterSource             setFilterSource
>         getPageNTarget              setPageNTarget
>         getPageSource               setPageSource
>         getRunMultiple              setRunMultiple
>         getUpdateSource             setUpdateSource
>         getUpdateTarget             setUpdateTarget]

> The cntnprto.i prototype file follows:

> cntnprto.i
>     /*
>      * Prototype include file: C:\adm90\src\adm2\cntnprto.i
>      * Created from procedure: C:\adm90\src\adm2\containr.p at 09:47 on 10/27/98
>      * by the PROGRESS PRO*Tools Prototype Include File Generator
>      */
>     /***** Start excluded prototypes
>     PROCEDURE viewPage IN SUPER:
>       DEFINE INPUT PARAMETER piPageNum AS INTEGER.
>     END PROCEDURE.
>     PROCEDURE selectPage IN SUPER:
>       DEFINE INPUT PARAMETER piPageNum AS INTEGER.
>     END PROCEDURE.
>     PROCEDURE removePageNTarget IN SUPER:
>       DEFINE INPUT PARAMETER phTarget AS HANDLE.
>       DEFINE INPUT PARAMETER piPage AS INTEGER.
>     END PROCEDURE.
>     PROCEDURE notifyPage IN SUPER:
>       DEFINE INPUT PARAMETER pcProc AS CHARACTER.
>     END PROCEDURE.
>     PROCEDURE initPages IN SUPER:
>       DEFINE INPUT PARAMETER pcPageList AS CHARACTER.
>     END PROCEDURE.
>     PROCEDURE initializeObject IN SUPER:
>     END PROCEDURE.
>     PROCEDURE deletePage IN SUPER:
>       DEFINE INPUT PARAMETER piPageNum AS INTEGER.
>     END PROCEDURE.
>     PROCEDURE createObjects IN SUPER:
>     END PROCEDURE.
>     PROCEDURE constructObject IN SUPER:
>       DEFINE INPUT PARAMETER pcProcName AS CHARACTER.
>       DEFINE INPUT PARAMETER phParent AS HANDLE.
>       DEFINE INPUT PARAMETER pcPropList AS CHARACTER.
>       DEFINE OUTPUT PARAMETER phObject AS HANDLE.
>     END PROCEDURE.
>     PROCEDURE confirmExit IN SUPER:
>       DEFINE INPUT-OUTPUT PARAMETER plCancel AS LOGICAL.
>     END PROCEDURE.
>     PROCEDURE changePage IN SUPER:
>     END PROCEDURE.
>     PROCEDURE assignPageProperty IN SUPER:
>       DEFINE INPUT PARAMETER pcProp AS CHARACTER.
>       DEFINE INPUT PARAMETER pcValue AS CHARACTER.
>     END PROCEDURE.
>     PROCEDURE start-super-proc IN SUPER:
>       DEFINE INPUT PARAMETER pcProcName AS CHARACTER.
>     END PROCEDURE.
>     FUNCTION getContainerTarget RETURNS CHARACTER IN SUPER.
>     FUNCTION getContainerTargetEvents RETURNS CHARACTER IN SUPER.
>     FUNCTION getDataTarget RETURNS CHARACTER IN SUPER.
>     FUNCTION getPageNTarget RETURNS CHARACTER IN SUPER.
>     FUNCTION getPageSource RETURNS HANDLE IN SUPER.
>     FUNCTION pageNTargets RETURNS CHARACTER
>       (INPUT phTarget AS HANDLE,
>        INPUT piPageNum AS INTEGER) IN SUPER.
>     FUNCTION setContainerTarget RETURNS LOGICAL
>       (INPUT pcObject AS CHARACTER) IN SUPER.
>     FUNCTION setDataTarget RETURNS LOGICAL
>       (INPUT pcTarget AS CHARACTER) IN SUPER.
>     FUNCTION setPageNTarget RETURNS LOGICAL
>       (INPUT pcObject AS CHARACTER) IN SUPER.
>     FUNCTION setPageSource RETURNS LOGICAL
>       (INPUT phObject AS HANDLE) IN SUPER.
>     END excluded prototypes ********/
>     FUNCTION getCurrentPage RETURNS INTEGER IN SUPER.

Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095