Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do you handle this folks?
Message
 
 
To
18/07/2000 16:19:45
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00393112
Message ID:
00394124
Views:
13
Vin,

>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 is our previous approach. The closable is set to .F. if _SCREEN.formcount > 1 and vice versa.

>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.

That's very true. And as Eric says, it is a weird and annoying behaviour.

>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.

What we did is, ON SHUTDOWN is set to default just before calling the form. We did it by changing the way we call form in the menu. Instead of using ON SELECTION BAR 1 OF blah... DO FORM our_form, we make it DO CALLFORM WITH "ourform" and in the CALLFORM routine we have this code:
PROCEDURE CallForm ( cForm )
    WAIT WINDOW "Loading form wait..." NOWAIT
    _SCREEN.MOUSEPOINTER = 11
    ON SHUTDOWN
    DO FORM (cform)
ENDPROC
In the destroy event of each modeless form we have a routine being invoked that determines form count value so that if it is equal to zero, ON SHUTDOWN DO exitproc is re-issued.

Thanks!
JESS S. BANAGA
Project Leader - SDD division
...shifting from VFP to C#.Net

CHARISMA simply means: "Be more concerned about making others feel good about themselves than you are in making them feel good about you."
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform