Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Stopping a SELECT command
Message
De
29/05/2002 10:01:50
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00661167
Message ID:
00662434
Vues:
35
>>>>What exactly you didn't understand? This code sets SET ESCAPE ON and also ON ESCAPE queryHalt = .t.
>>>>QueryHalt should be declared as private variable and set to .f. So, you would know, if user presses ESC by examing this variable. After select statement was ran, you have to restore original settings. That's why they are first saved, then restored... I just take out some code from our Query engine, you can modify it to fit your needs.
>>>>
>>>>Finally, you would be able to stop query only after the progress bar appears (that's why set talk on [I would also add SET TALK WINDOWS NOSHOW]). Sometimes, the joining part takes a long time, but you have no control to stop it...
>>>>
>>>>>I´m sorry, but I didn´t understand. Am I missing something? Could you please explain it to me?
>>>>>
>>>
>>>I didn´t understand, why setting a variable to .T. would stop a SELECT statement.
>>>
>>>Regards,
>>
>>Setting the variable to .T. won't stop anything.
>>
>>Changing the action for ON ERROR will change the default behaviour for errors. Thus, your program won't be interrupted.
>>
>>And changing the variable to .T. will indicate that an error / interruption ocurred.
>>
>>HTH, Hilmar.
>
>But pressing ESC with SET ESCAPE ON and ON ESCAPE kfjlskls doesn´t generate an error...
on escape x = y   && variable y isn't declared
for i = 1 to 100
  ? i
next
If I press ESC while VFP waits for input, nothing happens. OTOH, if I press ESC while the loop is working, I get the error message, that the variable isn't declared.

Apparently, then, ON ESCAPE isn't equivalent to ON KEY LABEL ESCAPE - the idea is not to intercept any time ESC is pressed, but to allow interruptions.

If, in addition to that, I use the following command:
on error MessageBox("An error has occured")
the standard error message (variable doesn't exist) gets replaced by the MessageBox.

Saludos, Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform