Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Escape a method
Message
De
11/05/2010 05:55:25
 
 
À
11/05/2010 05:47:50
Lutz Scheffler (En ligne)
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Divers
Thread ID:
01464090
Message ID:
01464123
Vues:
34
>>>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


It's not a timer, Agnes, timers don't fire when foxpro is very busy

It's something in the main loop that checks for user input every second (see Inkey())


ON ESCAPE may interrupt (and skip) an instruction
Gregory
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform