Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Destroy event does not fire when form is released
Message
 
 
To
20/11/2001 14:53:04
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00582372
Message ID:
00584169
Views:
43
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
Previous
Reply
Map
View

Click here to load this message in the networking platform