Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
On Escape
Message
De
28/02/2001 00:52:35
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Divers
Thread ID:
00480291
Message ID:
00480409
Vues:
14
>Ed,
>
>>If you're running a long, noin-interactive process, it's likely not even checking to see if a UI Event has occurred - try adding a DOEVENTS in the loop to let VFP check for UI events during the loop. This won't help you interrupt a single, long-running query statement - VFPtries to check the event queue
>
>
		* support user Escapes for interrupting query processing
>		prevonesc = on('escape')			&& save previous Escape handler
>		prevescape = set('escape')			&& previous Escape enablement state
>		set escape on						&& enable escape handling
>		querhalt = .f.						&& allow loop to run until this flag is toggled
>		on escape querhalt = .t.			&& force immediate termination if user escapes
>
>If you set this code before running long query, you would be able to interrupt query once progress bar shows up (set talk should be on for this).
>This code belongs to Mike Asherman and works fine.

If the Progress Bar is active, then VFP responds to UI events, doesn't it?

Like I said, if it's a long, non-interactive, non-UI code loop, VFP won't respond. I often decide that the better performance suppressing the UI is better than letting the user interrupt the runtime of loops and large SQL SELECTs. They can always start another session of VFP, or I can spawn the long operation to run a separate instance, with lower priority if necessary so the foreground VFP app stays responsive. Unless there's a good reason to stop the execution (not the user getting bored) why interrupt if you can work in parallel?

>I use the same technique for interrupting scan endcan process (or any loop) in a program.
>
>between statements, and within a tight loop in a single procedure, not running non-interactive code which is fully in-line without issuing a DOEVENTS (a call to an outside procedure will check as well). I'd add code in the loop something like:
>>
>>
IF CHRSAW() OR MDOWN()
>>   DOEVENTS
>>ENDIF
>>
>>and have a key assigned to the Cancel action to handle a pending Escape. This also would handle the situation where a user Clicked on a Cancel button or a similar control. It's a matter of allowing VFP to check the event loop while running something which isn't inherently interactive.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform