Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do you handle this folks?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00393112
Message ID:
00394031
Vues:
13
Hey Jess. I'll deal with your questions in reverse. First, it's standard windows behavior that even an hourglass'd mouse pointer can register a Click event. You'll see developers rely on it at times, in VB Apps in particular, in fact -- a "Process" button changes to a "Cancel" button and the developer uses DoEvents to register a click. You can verify this behavior in Outlook or Excel, in fact, by setting up a looping macro.

As for your Shutdown question, my startup code tends to look something like this:

* SETUP CODE:
_screen.Closable = .F.

on shutdown do YourShutDownProc
*' All your setup code goes here

_screen.Closable = .T.
* END SETUP CODE

This way, users cannot close until after the crucial stuff happens. By the way, the effect of the X button is to execute your shutdown routine IMMEDIATELY after the line of code that is currently executing -- not the current procedure, but the current line of code. In my opinion this leads to one of the most common gotchas in FoxPro apps. Let's say you have code that is doing something important, all of which must complete. Maybe you are writing data down to a set of temporary tables, and some other app relies on those files always being up to date. Guess what? If a user clicks X in the middle of the process, you will not have a complete set of files. FoxPro executes a shutdown at the point the X is clicked.

Again, one could argue "bad design" in such a case as the one outlined about, and you'd be right, but trust me this one can burn you. In fact, I have placed _screen.Closable code in my routines that change mousepointers to and from an hourglass, to help capture most circumstances.

Hope this helps.
The whole problem with the world is that fools and fanatics are always so certain of themselves, but wiser people so full of doubts. - Bertrand Russell
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform