Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Escape a method
Message
From
11/05/2010 05:47:50
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
 
 
To
11/05/2010 03:43:52
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01464090
Message ID:
01464122
Views:
30
>>Hi,
>>
>>following problem occurs to me:
>>I have a method that controls the data generation for reports. This could be complex calculation. If the user selects the wrong range it could run for a while.
>>The control is generic, controled by a table. The calculation methods are well tested and established, and there is a large number of it. The callstack of the calculation could be variable, the position of the generic control too.
>>
>>Now the user likes to stop the generation.
>>
>>Is there a chance to use ESC key and/or some button to stop the generation without changing the calculation methods?
>>
>>TIA
>>
>>Agnes
>
>
>Agnes,
>
>One way to go is to use SET ESCAPE ON. However, as far as I can remember, this may interrupt queries and can interrupt your calculation at some point and leave your program or routine in an inconsistent state
>
>I have found this in one of my comments
>
>&& do not use ON Escape.  It interrupts requery() and skips a line of code( Error 1213)
>
>
>The way I have done this - in a very cpu intensive class - is to check for user input every second or so
>
>Basically, you call a function every second. If there was user input, you set a flag
>It's up to you to test for the flag and exit gracefully
>
>
>if( !empty(inkey(.0001, 'H')) )
>	this.SearchEscaped = TRUE
>	 &&return FALSE
>endif
>
>
>At certain points you test for
>
>if ( m.this.SearchEscaped )
> .... stop what you are doing
>endif
>
>
>
>Advantages
>- you control when to check for user input
>- you control when and where to exit gracefully

Finaly an ON ESCAPE could set some property too, so I would not need the timer.

I fear customers inconvenience will not be high enough to pay this rework. So we put this back to its 10 year old tomb.

(-.-)
Agnes
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform