Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Screen won't close in VFP 7.0, but did in 6.0...
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00655728
Message ID:
00655774
Views:
28
Joe,

>I have a form that won't close. It properly releases all references to itself and to a child screen, but THISFORM.Release() leaves the form up in limbo-mode...it can't be closed (not with a CLose button or with the system "X") and the application can't be ended with File | Exit or the "X" (ON SHUTDOWN...). Nothing I do seems to make it able to close properly.
>

I found that VFP7 is more strict concerning open object references.

I found that when going from VFP6 to 7 in all of theese cases it
was always a dangling oR that VFP6 simply threw away while 7 couldn't
(or did not want to).

I had theese specially when doing things with OLE-Controls / OCX's and
still was in a method or an event of that control while I wanted to
close the form. Normally everything was fine, but when I stress-tested
my apps and produced errors within the control's methods. There
sometimes was no way release the control that caused the error and thus
no way to release the form
So I strictly took those away from this kind of controls
by separating them via timers.

Just a simple class like this
DEFINE CLASS trmAction as TIMER

n_Delay   = 20
c_Command = ""

PROCEDURE SetCommand
lparameters tc_Command, tn_Delay

if vartype(tc_Command) # "C"
  return .F.
endif

this.c_Command = allt(tc_Command)
This.Enabled   = .T.
This.Interval  = iif(vartype(tn_Delay)="N", tn_Delay, This.n_Delay)
return .T.

ENDPROC

PROCEDURE TIMER
local lc_Cmd
*-- Prevent from firing twice on
*-- short intervals
This.Enabled = .F.

*-- Maybe some Checks here

*-- and then fire the actual command
lc_Cmd = allt(This.c_Command)
&lc_Cmd

ENDPROC
ENDDEFINE

An event of an OCX/OLE-Control now always sets a timer and immediately
returns to the control. a few ms later the timer fires once and calls
a method in a true VFP-object

HTH
Regards from Berlin

Frank

Dietrich Datentechnik (Berlin)
Softwarekombinat Teltow (Teltow)

Frank.Dietrich@dd-tech.de
DFPUG # 327
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform