OO control flow of program question.

Posted by OctavioOlguin on 02-Mar-2017 12:13

I have this class.  It needs visual representation.  

(so it has on InitializeComponents:  THIS-OBJECT:Load:Subscribe(THIS-OBJECT:BioLogin_Load).  )

I managed to do polimorphism with this class...

 CONSTRUCTOR PUBLIC BioLogin ( INPUT pOperacion AS CHARACTER ):
        
        SUPER().
        InitializeComponent().
        THIS-OBJECT:ComponentsCollection:ADD(THIS-OBJECT:components).
        ASSIGN            
            pRequestedOperation = pOperacion.         
        ProcessOperation(pOperacion).
        
        THIS-OBJECT:CLOSE ().    // this is the problem  <<-----
                
        CATCH e AS Progress.Lang.Error:
            UNDO, THROW e.
        END CATCH.
    END CONSTRUCTOR.
    
    
    CONSTRUCTOR PUBLIC BioLogin ( INPUT pNomina AS INTEGER, INPUT pOperacion AS CHARACTER, INPUT pNmbr AS INTEGER ):
        
        SUPER().
        InitializeComponent().
        THIS-OBJECT:ComponentsCollection:ADD(THIS-OBJECT:components).
        ASSIGN
            pNominaEmpleado      = pNomina   // inyeccion de parámetros...
            pOperacionSolicitada = pOperacion
            pDedoARegistrar      = pNmbr. 
        
        CATCH e AS Progress.Lang.Error:
            UNDO, THROW e.
        END CATCH.
    END CONSTRUCTOR.
    
    CONSTRUCTOR  PUBLIC BioLogin ( ):        
        SUPER().
        InitializeComponent().
        THIS-OBJECT:ComponentsCollection:ADD(THIS-OBJECT:components).
                
        CATCH e AS Progress.Lang.Error:
            UNDO, THROW e.
        END CATCH.
    END CONSTRUCTOR.

but have the problem (indicated on code).

there is a use case of the class where I don't need/want visual representation. (first constructor).  So it runs method processOperation(pOperacion), I would like to terminate this instance of the run and return to previous UIB window.

The calling procedure (UIB ABL) does the following to instantiate biologin

rTemp = NEW BioLogin ( "Asistencia" ) .
WAIT-FOR rTemp:showDialog().
DELETE OBJECT rTemp.

The problem is after the exit condition on the ProcessOperation(pOperacion) is met (7 seconds of inactivity) I want to return to caller, but it creates a 

System.ObjectDisposedException: Cannot access a disposed object.

error, so I'm lost.

TIA

Posted by Thomas Mercer-Hursh on 02-Mar-2017 13:36

My initial reaction, now pointed to by Laura, is that this is a problem of application partitioning.  Having one use of the class visual and another not makes it clear you are trying to mush together things in one place that belong in two or more.

All Replies

Posted by Laura Stern on 02-Mar-2017 12:47

Sorry, I'm totally confused.

1. It would help to see what the CLASS statement looks like.  Does this class inherit from a Form?  I assume so.

2. I don't know what you mean by that you don't want any "visualization with the first constructor.  None of these constructors actually visualizes the form.  That is done by the caller.  The visualization happens when you call ShowDialog().  If you don't want to see it, why are you doing that?  

3. The call to Close() is failing because the form hasn't been displayed yet.  You can't close something that hasn't been opened.  You don't need to call that.  

4. And if you are not going to visualize this w/ contructor 1, why is it part of a class that is a form?  And why would you call InitializeComponent() which is setting up all the controls, etc that will be visualized if you never want to visualize it?

5. What does this have to do with polymorphism?  I think maybe you mean method overloading?  

Posted by OctavioOlguin on 02-Mar-2017 13:03

this is biologin

/*------------------------------------------------------------------------
   File        : BioLogin
   Purpose     : Access control to packages sales
   Syntax      : 
   Description : 
   Author(s)   : Isai Padron.    
   Created     : Mon Nov 23 15:04:32 CST 2015
   Notes       : JOA   23/02/17
   
   
   
 ----------------------------------------------------------------------*/

BLOCK-LEVEL ON ERROR UNDO, THROW.

USING Progress.Windows.Form     FROM ASSEMBLY.
USING Suprema.UFMatcher         FROM ASSEMBLY.
USING Suprema.UFS_STATUS        FROM ASSEMBLY.
USING Suprema.UFScanner         FROM ASSEMBLY.
USING Suprema.UFScannerManager  FROM ASSEMBLY.
USING System.Drawing.Graphics   FROM ASSEMBLY.
USING System.Drawing.Rectangle  FROM ASSEMBLY.
USING System.IO.*               FROM ASSEMBLY.


BLOCK-LEVEL ON ERROR UNDO, THROW.                              

  
CLASS procs.Bio.BioLogin INHERITS Form: 
       	
    DEFINE PRIVATE VARIABLE btnStart             AS System.Windows.Forms.Button      NO-UNDO.
    DEFINE PRIVATE VARIABLE components           AS System.ComponentModel.IContainer NO-UNDO.
   
    DEFINE PRIVATE VARIABLE lbFinger             AS System.Windows.Forms.Label       NO-UNDO.
    DEFINE PRIVATE VARIABLE lblNombre            AS System.Windows.Forms.Label       NO-UNDO.
    DEFINE PRIVATE VARIABLE pBoxfPrint           AS System.Windows.Forms.PictureBox  NO-UNDO.
    
    
    DEFINE PRIVATE VARIABLE scannerManager       AS Suprema.UFScannerManager         NO-UNDO.
    DEFINE PRIVATE VARIABLE Scanner              AS Suprema.UFScanner                NO-UNDO.
    DEFINE PRIVATE VARIABLE Matcher              AS Suprema.UFMatcher                NO-UNDO .
    DEFINE PRIVATE VARIABLE ufs_res              AS UFS_STATUS                       NO-UNDO.
    DEFINE PRIVATE VARIABLE SerieDelScanner      AS CHARACTER                        NO-UNDO.
    DEFINE PUBLIC  VARIABLE GlobalError          AS CHARACTER                        NO-UNDO.  // contiene los mensajes de error que se han obtenido.
    
    DEFINE PRIVATE VARIABLE minQuality           AS INTEGER                          NO-UNDO INITIAL 50.
    DEFINE PRIVATE VARIABLE nType                AS INTEGER                          NO-UNDO INITIAL 2001.
    
    DEFINE PRIVATE VARIABLE max_template_size    AS INTEGER                          NO-UNDO INITIAL 512.
    DEFINE PRIVATE VARIABLE Template             AS "System.Byte[]"                  NO-UNDO.
    DEFINE PRIVATE VARIABLE TemplateSize         AS INTEGER                          NO-UNDO.
    DEFINE PRIVATE VARIABLE EnrollQuality        AS INTEGER                          NO-UNDO.  // obtenida por el scanner cuando lee una huella.
    DEFINE PRIVATE VARIABLE ptrTemplate          AS MEMPTR                           NO-UNDO.  // aqui se baja desde el registro de la db, para procesarlo.
    //DEFINE PRIVATE VARIABLE template2         AS "System.Byte[][]"                         NO-UNDO.     cuando se haga match con todos los templates cargados..  ahora solo validamos que el usuario en cuestion, tenga un template que haga match.
    
    DEFINE PRIVATE VARIABLE pNominaEmpleado      AS INTEGER                          NO-UNDO.
    DEFINE PRIVATE VARIABLE pOperacionSolicitada AS CHARACTER                        NO-UNDO.
    DEFINE PRIVATE VARIABLE pDedoARegistrar      AS INTEGER                          NO-UNDO.
    
    DEFINE         VARIABLE NominaIdentificada   AS INTEGER                          NO-UNDO.   // es la nomina del dedo que se acaba de leer.
    
    DEFINE TEMP-TABLE ttblobTemplates NO-UNDO
        FIELD TemplateField  AS BLOB
        FIELD TemplateLenght AS INTEGER. 

    /* vamos a validar todos los usuarios de una vez */
    CONSTRUCTOR PUBLIC BioLogin ( INPUT pOperacion AS CHARACTER ):
        
        SUPER().
        InitializeComponent().
        THIS-OBJECT:ComponentsCollection:ADD(THIS-OBJECT:components).
        ASSIGN            // inyeccion de parámetros...
            pOperacionSolicitada = pOperacion. 
        
        ProcesaOperacion(pOperacion).
        
        THIS-OBJECT:CLOSE ().
                
        CATCH e AS Progress.Lang.Error:
            UNDO, THROW e.
        END CATCH.
    END CONSTRUCTOR.
    
    
    CONSTRUCTOR PUBLIC BioLogin ( INPUT pNomina AS INTEGER, INPUT pOperacion AS CHARACTER, INPUT pDedo AS INTEGER ):
        
        SUPER().
        InitializeComponent().
        THIS-OBJECT:ComponentsCollection:ADD(THIS-OBJECT:components).
        ASSIGN
            pNominaEmpleado      = pNomina   // inyeccion de parámetros...
            pOperacionSolicitada = pOperacion
            pDedoARegistrar      = pDedo. 
        
        //ProcesaOperacion(pOperacion).
        
        CATCH e AS Progress.Lang.Error:
            UNDO, THROW e.
        END CATCH.
    END CONSTRUCTOR.
    
    CONSTRUCTOR  PUBLIC BioLogin ( ):
        
        SUPER().
        InitializeComponent().
        THIS-OBJECT:ComponentsCollection:ADD(THIS-OBJECT:components).
                
        CATCH e AS Progress.Lang.Error:
            UNDO, THROW e.
        END CATCH.
    END CONSTRUCTOR.
    
    /*------------------------------------------------------------------------------
     Purpose:
     Notes:   próximo a eliminar
    ------------------------------------------------------------------------------*/
    /*    @VisualDesigner.                                                                                                    */
    /*    METHOD PRIVATE VOID BioLogin_KeyDown( INPUT sender AS System.Object, INPUT e AS System.Windows.Forms.KeyEventArgs ):*/
    /*        MESSAGE e:KeyValue                                                                                              */
    /*            VIEW-AS ALERT-BOX.                                                                                          */
    /*    END METHOD.                                                                                                         */

    /*------------------------------------------------------------------------------
     Purpose:When the form loads, it checks if scanner is connected.
     Notes:
    ------------------------------------------------------------------------------*/
    @VisualDesigner. 
    METHOD PRIVATE VOID BioLogin_Load( INPUT sender AS System.Object, INPUT e AS System.EventArgs ):
                
        InicializaScanner().
        IF pOperacionSolicitada = "Asistencia" THEN 
        DO:
            THIS-OBJECT:CLOSE ().
        END.
                         
    END METHOD.
   



    /*------------------------------------------------------------------------------
     Purpose:Start scanning
     Notes:
    ------------------------------------------------------------------------------*/
    @VisualDesigner. 
    METHOD PRIVATE VOID btnStart_Click( INPUT sender AS System.Object, INPUT e AS System.EventArgs ):
        
        /*        CASE pOperacionSolicitada:   */
        /*            WHEN "Registrar" THEN    */
        /*                RegistraH uella().    */
        /*            WHEN "Asistencia" THEN   */
        /*                Registra Asistencia().*/
        /*            WHEN "Validar" THEN      */
        /*                MatchEm pleado().     */
        /*        END CASE.                    */

        leerHuella().
        

        THIS-OBJECT:CLOSE ().
 

    END METHOD.

    
    /*------------------------------------------------------------------------------
     Purpose:
     Notes:
    ------------------------------------------------------------------------------*/
    METHOD PUBLIC VOID InicializaScanner(  ):
		
        Scanner = ?.
        scannerManager = NEW UFScannerManager(THIS-OBJECT).
        ufs_res = scannerManager:Init().
        
        Scanner = scannerManager:Scanners[0].
        IF Scanner = ? THEN
        DO:
            reportaError("Error incializando el scaner").
            RETURN.
        END.
        
        FIND Empleado NO-LOCK
            WHERE Empleado.Nomina = pNominaEmpleado NO-ERROR.            
            
        ASSIGN
            SerieDelScanner       = Scanner:Serial            
            Scanner:Timeout       = 5000
            Scanner:TemplateSize  = max_template_size
            Scanner:DetectCore    = FALSE
            Scanner:nTemplateType = nType.
            
        IF AVAILABLE (Empleado) THEN 
            ASSIGN 
                lblNombre:Text = Empleado.Nombre .
        RETURN.

    END METHOD.

    METHOD PUBLIC VOID  LeerHuella(  ):
        /*------------------------------------------------------------------------------*/
        /* Purpose: Obtiene el template de una huella                                   */
        /* Notes:                                                                       */
        /*------------------------------------------------------------------------------*/

        DEFINE VARIABLE ufs_res AS UFS_STATUS NO-UNDO.
        DEFINE VARIABLE Scanner AS UFScanner  NO-UNDO.

        Scanner = scannerManager:Scanners[0].
        IF Scanner = ? THEN 
        DO:
            reportaError("No se pudo seleccionar el scanner dentro de los dispositivos de la computadora.").
            RETURN.
        END.
        
        lbFinger:Visible = TRUE.
        Scanner:ClearCaptureImageBuffer().
        DrawCaptureImage(Scanner).
        ufs_res = Scanner:CaptureSingleImage().
            
        IF STRING(ufs_res) <> STRING(UFS_STATUS:OK) THEN 
        DO:
            reportaError("No se leyó nada desde el scanner").
            RETURN .             
        END.

        Template = NEW "System.Byte[]" (max_template_size).
        ufs_res = Scanner:Extract(Template, OUTPUT TemplateSize, OUTPUT EnrollQuality).
            
        DrawCaptureImage(Scanner).
        lbFinger:Visible = FALSE.
        IF STRING(ufs_res) <> STRING(UFS_STATUS:OK) THEN
        DO:
            reportaError("Error interpretando la huella").
            RETURN.
        END.
        IF EnrollQuality < minQuality THEN
        DO: 
            reportaError("La calidad de la huella es muy baja.").
            RETURN .
        END.
            //  por fin.. tenemos una huella... vamos a guardarla para quien la requiera....
            
        ASSIGN
            Template = NEW "System.Byte[]" (max_template_size)
            ufs_res  = Scanner:Extract(Template,TemplateSize, EnrollQuality).

    END METHOD.


    METHOD PUBLIC VOID GetTemplate (OUTPUT tem AS "System.Byte[]" , OUTPUT len AS INTEGER, OUTPUT Qua AS INTEGER ):
        /*------------------------------------------------------------------------------
         Purpose:   Regresa el template, la longitud del mismo y la calidad de lectura, de la ultima huella leida
         Notes:
        ------------------------------------------------------------------------------*/
        ASSIGN 
            tem = Template
            len = TemplateSize
            qua = EnrollQuality.
    
    END METHOD.
    
    
    /*------------------------------------------------------------------------------
     Purpose:
     Notes:
    ------------------------------------------------------------------------------*/
    METHOD PUBLIC INTEGER MatchEmpleado(  ):
		
        DEFINE VARIABLE myTemplate      AS "System.Byte[]" NO-UNDO.
        DEFINE VARIABLE myTemplateSize  AS INTEGER         NO-UNDO.
        DEFINE VARIABLE myEnrollQuality AS INTEGER         NO-UNDO.  // obtenida por el scanner cuando lee una huella.
    
        
        GetTemplate(OUTPUT myTemplate, OUTPUT myTemplateSize, OUTPUT myEnrollQuality).
        
        FOR EACH EmpleadoTemplates NO-LOCK:
            IF validaEmpleado(EmpleadoTemplates.Nomina, myTemplate, myTemplateSize)  THEN 
                RETURN  EmpleadoTemplates.Nomina.
        END.

        RETURN 0.

    END METHOD.

    METHOD PRIVATE VOID ProcesaOperacion( INPUT pOps AS CHARACTER ):
        DEFINE VARIABLE Asistente AS INTEGER NO-UNDO INITIAL -1.
        
        IF pOps = "Asistencia" THEN 
        DO:
            REPEAT WHILE asistente <> 0:
                
                THIS-OBJECT:InicializaScanner().
                THIS-OBJECT:LeerHuella().
                Asistente = THIS-OBJECT:MatchEmpleado().

                IF asistente > 0 THEN 
                DO:
                    FOR EACH ProgramaSucursal WHERE fecha  = TODAY
                        AND ProgramaSucursal.Nomina = asistente:
                        ASSIGN 
                            ProgramaSucursal.Asistencia  = YES
                            ProgramaSucursal.HoraEntrada = TIME.
                    END.
                END.
            END.
        END.
        RETURN.

    END METHOD.


    METHOD PUBLIC LOGICAL ValidaEmpleado( INPUT pNomina AS INTEGER, INPUT candidato AS "System.Byte[]", INPUT CandidatoSize AS INTEGER ):
        /*------------------------------------------------------------------------------          */
        /* Purpose:   Dado un Template recién obtenido de un empleado (candidato), carga todas los*/
        /*            templates asignado a el, para hacer un match con estos, y así validar que el*/
        /*            candidato esta registrado con ese template anteriormente...                 */
        /* Notes:                                                                                 */
        /*------------------------------------------------------------------------------          */
        
        DEFINE VARIABLE ResultadoMatch AS LOGICAL         NO-UNDO.   // contiene el resultado del match que nos ocupa...
        DEFINE VARIABLE memptr2        AS MEMPTR          NO-UNDO.
        DEFINE VARIABLE lenMem2        AS INTEGER         NO-UNDO.  
        DEFINE VARIABLE bytetemp2      AS "System.Byte[]" NO-UNDO.
        
        ASSIGN
            Matcher               = NEW ufMatcher()
            Matcher:FastMode      = TRUE
            Matcher:nTemplateType = nType   // Scanner:nTemplateType = nType  se usó en la captura original..
            Matcher:SecurityLevel = 5.
        
        myVerify:
        FOR EACH EmpleadoTemplates NO-LOCK
            WHERE EmpleadoTemplates.Nomina = pNomina.

            ASSIGN
                memptr2        = EmpleadoTemplates.Template
                lenMem2        = EmpleadoTemplates.Longitud
                ResultadoMatch = NO     // vamos a comenzar. esperando lo peor...   
                ByteTemp2      = MemptrToByteArray( memptr2 ).   // si bien, a continuación utilizamos la longitud del elemento BYTE[], y lo pasamos como
                                                                 // long. del elemento memptr, al parecer, las lognitudes de los dos elementos es la misma.
            Matcher:Verify(Candidato, CandidatoSize, ByteTemp2, lenMem2, OUTPUT ResultadoMatch).    //System.IO.File:WriteAllBytes("C:\t\t.txt", Template).            
            ASSIGN
                memptr2           = ?
                ByteTemp2         = ?
                SET-SIZE(memptr2) = 0.
            
            IF STRING(ufs_res) <> STRING(UFS_STATUS:OK) THEN 
            DO:
                reportaError("Error extrayendo la huella para validar al empleado").
                LEAVE myVerify.
            END.
            IF ResultadoMatch THEN
                LEAVE myVerify.                //RUN procs\nom\RegistraAsistencia.p( Empleado.Nomina ).
            
        END.        

        RETURN ResultadoMatch.
        
    END METHOD.

    
    METHOD PRIVATE VOID RegistraHuella(  ):
	    
        FIND EmpleadoTemplates NO-LOCK
            WHERE EmpleadoTemplates.Nomina = pNominaEmpleado                            // "Esa huella ya se habia registrado al empleado"  
            AND   EmpleadoTemplates.FingerIndex = pDedoARegistrar NO-ERROR.             // "actualizar el registro anterior"                

        IF NOT AVAILABLE(EmpleadoTemplates ) THEN 
        DO:
            CREATE EmpleadoTemplates.
            ASSIGN 
                EmpleadoTemplates.Nomina      = pNominaEmpleado
                EmpleadoTemplates.FingerIndex = pDedoARegistrar .
        END.
        ELSE 
        DO:  
            IF  (EmpleadoTemplates.Calidad > EnrollQuality) THEN        // si la calidad actual es mejor que la anterior... no hacer nada 
                RETURN.

            FIND CURRENT EmpleadoTemplates EXCLUSIVE-LOCK.
        END.
        ASSIGN 
            EmpleadoTemplates.Template = ByteArrayToMemptr(template)
            EmpleadoTemplates.Longitud = TemplateSize
            EmpleadoTemplates.Calidad  = EnrollQuality
            EmpleadoTemplates.Fecha    = NOW
            EmpleadoTemplates.Nota1    = STRING(NOW) + "    No. Serie del scanner: " + string(SerieDelScanner)  + "~n" + EmpleadoTemplates.Nota1. 
        FIND CURRENT EmpleadoTemplates NO-LOCK.
          
		
        RETURN.

    END METHOD.
    
    METHOD PRIVATE VOID DrawCaptureImage(INPUT Scanner AS UFScanner):      // Purpose:   Magically Drawing a image from scanner.
        DEFINE VARIABLE gp  AS Graphics  NO-UNDO.     
        DEFINE VARIABLE rec AS Rectangle NO-UNDO.
    
        gp = pBoxfPrint:CreateGraphics().  
        rec = NEW Rectangle(0,0, pBoxfPrint:Width, pBoxfPrint:Height).
        
        Scanner:DrawCaptureImageBuffer(gp, rec, FALSE).
        gp:Dispose().
    END. 
    
    METHOD PRIVATE STATIC MEMPTR ByteArrayToMemptr (poBytes AS "System.Byte[]":U):
 
        DEFINE VARIABLE myMemptr    AS MEMPTR        NO-UNDO .
        DEFINE VARIABLE oIntPointer AS System.IntPtr NO-UNDO .
 
        SET-SIZE (myMemptr) = poBytes:Length .
        oIntPointer = NEW System.IntPtr (GET-POINTER-VALUE (myMemptr)).
        System.Runtime.InteropServices.Marshal:Copy (poBytes, 0, oIntPointer, poBytes:Length).
        RETURN myMemptr.
 
        FINALLY:
            DELETE OBJECT oIntPointer.
        END FINALLY.
 
    END METHOD .
           
    METHOD PRIVATE STATIC "System.Byte[]" MemptrToByteArray( pmptr AS MEMPTR ):
        DEFINE VARIABLE nPtr   AS System.IntPtr   NO-UNDO.
        DEFINE VARIABLE vInt   AS INTEGER         NO-UNDO.
        DEFINE VARIABLE nBytes AS "System.Byte[]".
     
        vInt = GET-SIZE(pmPtr).
        nBytes = NEW "System.Byte[]"(vInt).
        nPtr = NEW System.IntPtr(GET-POINTER-VALUE(pmPtr)).
        System.Runtime.InteropServices.Marshal:Copy(nPtr, nBytes, 0, vInt).
     
        RETURN nBytes.
        FINALLY:
            nPtr = ?.
            set-size(pmPtr) = 0.
            nBytes = ?.
        END.
         
    END METHOD.
   // - See more at: community.progress.com/.../100235
    
   
    METHOD PRIVATE VOID InitializeComponent(  ):
		
        /* NOTE: The following method is automatically generated.
                                        
        We strongly suggest that the contents of this method only be modified using the
        Visual Designer to avoid any incompatible modifications.
                                        
        Modifying the contents of this method using a code editor will invalidate any support for this file. */
        @VisualDesigner.FormMember (NeedsInitialize="true").
        DEFINE VARIABLE resources AS Progress.Util.ResourceManager NO-UNDO.
        resources = NEW Progress.Util.ResourceManager("procs.Bio.BioLogin").
        THIS-OBJECT:pBoxfPrint = NEW System.Windows.Forms.PictureBox().
        THIS-OBJECT:btnStart = NEW System.Windows.Forms.Button().
        THIS-OBJECT:lbFinger = NEW System.Windows.Forms.Label().
        THIS-OBJECT:lblNombre = NEW System.Windows.Forms.Label().
        CAST(THIS-OBJECT:pBoxfPrint, System.ComponentModel.ISupportInitialize):BeginInit().
        THIS-OBJECT:SuspendLayout().
        /*  */
        /* pBoxfPrint */
        /*  */
        THIS-OBJECT:pBoxfPrint:BackColor = System.Drawing.SystemColors:AppWorkspace.
        THIS-OBJECT:pBoxfPrint:Location = NEW System.Drawing.Point(12, 12).
        THIS-OBJECT:pBoxfPrint:Name = "pBoxfPrint".
        THIS-OBJECT:pBoxfPrint:Size = NEW System.Drawing.Size(170, 231).
        THIS-OBJECT:pBoxfPrint:TabIndex = 1.
        THIS-OBJECT:pBoxfPrint:TabStop = FALSE.
        /*  */
        /* btnStart */
        /*  */
        THIS-OBJECT:btnStart:Location = NEW System.Drawing.Point(12, 286).
        THIS-OBJECT:btnStart:Name = "btnStart".
        THIS-OBJECT:btnStart:Size = NEW System.Drawing.Size(170, 33).
        THIS-OBJECT:btnStart:TabIndex = 2.
        THIS-OBJECT:btnStart:Text = "Escanear".
        THIS-OBJECT:btnStart:UseCompatibleTextRendering = TRUE.
        THIS-OBJECT:btnStart:UseVisualStyleBackColor = TRUE.
        THIS-OBJECT:btnStart:Click:Subscribe(THIS-OBJECT:btnStart_Click).
        /*  */
        /* lbFinger */
        /*  */
        THIS-OBJECT:lbFinger:Image = CAST(resources:GetObject("lbFinger.Image"), System.Drawing.Image).
        THIS-OBJECT:lbFinger:Location = NEW System.Drawing.Point(12, 246).
        THIS-OBJECT:lbFinger:Name = "lbFinger".
        THIS-OBJECT:lbFinger:Size = NEW System.Drawing.Size(170, 28).
        THIS-OBJECT:lbFinger:TabIndex = 3.
        THIS-OBJECT:lbFinger:UseCompatibleTextRendering = TRUE.
        /*  */
        /* lblNombre */
        /*  */
        THIS-OBJECT:lblNombre:Font = NEW System.Drawing.Font("Microsoft Sans Serif", Progress.Util.CastUtil:ToSingle(11), System.Drawing.FontStyle:Regular, System.Drawing.GraphicsUnit:Point, System.Convert:ToByte(0)).
        THIS-OBJECT:lblNombre:Location = NEW System.Drawing.Point(12, 341).
        THIS-OBJECT:lblNombre:Name = "lblNombre".
        THIS-OBJECT:lblNombre:Size = NEW System.Drawing.Size(170, 23).
        THIS-OBJECT:lblNombre:TabIndex = 4.
        THIS-OBJECT:lblNombre:Text = "label1".
        THIS-OBJECT:lblNombre:UseCompatibleTextRendering = TRUE.
        /*  */
        /* BioLogin */
        /*  */
        THIS-OBJECT:ClientSize = NEW System.Drawing.Size(199, 373).
        THIS-OBJECT:Controls:Add(THIS-OBJECT:lblNombre).
        THIS-OBJECT:Controls:Add(THIS-OBJECT:lbFinger).
        THIS-OBJECT:Controls:Add(THIS-OBJECT:btnStart).
        THIS-OBJECT:Controls:Add(THIS-OBJECT:pBoxfPrint).
        THIS-OBJECT:FormBorderStyle = System.Windows.Forms.FormBorderStyle:FixedSingle.
        THIS-OBJECT:Name = "BioLogin".
        THIS-OBJECT:StartPosition = System.Windows.Forms.FormStartPosition:CenterScreen.
        THIS-OBJECT:Text = "BioLogin".
        THIS-OBJECT:Load:Subscribe(THIS-OBJECT:BioLogin_Load).
        //THIS-OBJECT:KeyDown:Subscribe(THIS-OBJECT:BioLogin_KeyDown).
        CAST(THIS-OBJECT:pBoxfPrint, System.ComponentModel.ISupportInitialize):EndInit().
        THIS-OBJECT:ResumeLayout(FALSE).
        CATCH e AS Progress.Lang.Error:
            UNDO, THROW e.
        END CATCH.
    END METHOD.


    METHOD PRIVATE VOID ReportaError( INPUT cadena AS CHARACTER ):
		
        ASSIGN 
            GlobalError = cadena.        

    END METHOD.

    /*------------------------------------------------------------------------------
     Purpose:
     Notes:
    ------------------------------------------------------------------------------*/

    METHOD PUBLIC INTEGER UsuarioValidado(  ):
		
        RETURN NominaIdentificada.

    END METHOD.

    DESTRUCTOR PUBLIC BioLogin ( ):
        ufs_res = scannerManager:Uninit() .
    END DESTRUCTOR.
    
END CLASS.

...

Are you implicating that I could call the class with out showing?  It would be nice...

I call this object with the :

rTemp = NEW BioLogin ( "Asistencia" ) .
WAIT-FOR rTemp:showDialog().

So I taked out the WAIT-FOR, and worked like a charm...

Posted by Laura Stern on 02-Mar-2017 13:07

You didn't need to show the entire source code!

Anyway, Yes, that's what I'm saying.  This is just a class.  Constructing it does NOT visualize it.  As I said - it is the call to ShowDialog() that visualizes it.  But again - if you want to do something that has nothing to do with it being a visible Form than it probably shouldn't be part of this class.

Posted by OctavioOlguin on 02-Mar-2017 13:10

I insisted on usign visuals by the WAIT-FOR rTemp:SHOW, as other post I collected gave me the idea of the need of the

fingerprint device to boud by the : scannerManager = NEW UFScannerManager(THIS-OBJECT).

 

Posted by OctavioOlguin on 02-Mar-2017 13:12

And hope the source code help other newbies like me  ;)

Posted by Thomas Mercer-Hursh on 02-Mar-2017 13:36

My initial reaction, now pointed to by Laura, is that this is a problem of application partitioning.  Having one use of the class visual and another not makes it clear you are trying to mush together things in one place that belong in two or more.

Posted by jquerijero on 02-Mar-2017 13:38

[EDIT] Disregard: I missed the THIS-OBJECT:Close() inside the constructor.

This thread is closed