Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Destroy event does not fire when form is released
Message
 
 
À
20/11/2001 14:53:04
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00582372
Message ID:
00584169
Vues:
47
I put all the following code in a PUMP.PRG file
DEFINE CLASS xForm as Form

   DataSession = 2
   oComm = .null.

   PROCEDURE init
      This.oComm = createobject( "mscommlib.MSComm" )
      EVENTHANDLER( this.oComm, NEWOBJECT("commevents", 'pump.prg' ) )
   ENDPROC
ENDDEFINE

DEFINE CLASS commevents AS custom

 IMPLEMENTS DMSCommEvents IN "mscommlib.MSComm"

 procedure Destroy
   ? 'destroy fired'
 ENDPROC
 PROCEDURE DMSCommEvents_OnComm() AS VOID;
  HELPSTRING "Occurs whenever the value of the CommEvent property changes."
 ENDPROC
ENDDEFINE
From the command window, I did the following:
o = NEWOBJECT('xform', 'pump.prg')
o.Show()
I then click the close button the form, the Destroy does fire, the form is released, and I have no dangling private data session. Look for code in your form that may prevent the destroy in the CommEvents class from firing.

Also, please try what I have above to see if it works for you. Then lets procede from that point. It will probably be easier to build from something that does work than from something that is failing.
Mark McCasland
Midlothian, TX USA
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform