Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Proper cleanup
Message
From
14/02/2002 13:05:03
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00620112
Message ID:
00620180
Views:
14
>>>Hi everybody,
>>>
>>>Here is a problem:
>>>
>>>Class (or program) does some long process (Excel automation), but does not use any VFP specific loop construction. This class (program) shows an animation (using animation class), so user can at least be enterteined by this. However, some users (which are impatient, as I'm) could be tired of waitng and want to stop this long process right away. So, the problem is: how can we stop the process and return control to the main program, which invoked this long process program?
>>>
>>>What could be your ideas?
>>>
>>>Thanks a lot in advance.
>>
>>Nadya,
>>
>>would this work for you ?
>>
>>
>>local sEscape, sOnEscape
>>private Escaped
>>Escaped = FALSE
>>sEscape = Set('Escape')
>>sOnEscape = On('Escape')
>>on escape escaped = TRUE
>>set escape On
>>
>>&& long process loop, may be a call to any function or procedure, which cleans up the animation
>>
>>if( Escaped )
>>   && interrupted
>>endif
>>
>>
>>on escape &sOnEscape
>>set escape &sEscape
>>
>
>Hi Gregory,
>
>Great minds think alike :) I was thinking exactly the same and implemented it, but here is a problem: since the calling program (class) doesn't use any loop constructions, you would need to wrap every single command with this statement, which is no good. I don't like timer's idea here, but I currently don't see other possibilities...

Supposing the class/prg yiu are calling can be interrupted
local sEscape, sOnEscape
private Escaped
Escaped = FALSE
sEscape = Set('Escape')
sOnEscape = On('Escape')
on escape escaped = TRUE
set escape On

=LongProcedure()

if( Escaped )
   && interrupted
endif


on escape &sOnEscape
set escape &sEscape
proc longprocedure()

local obj

obj = CreateObject( .... whatever )
=obj.Process(.....)
&& if you get here it's either finished or escaped

&& obj will be released since it is a local
&& the only thing left is to close excel or animation class
&& maybe obj.Release() or obj.Quit
endproc
Can you be a bit more specific ?
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform