Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Execute code before closing form
Message
De
29/03/2007 09:12:48
Hans-Otto Lochmann
Dr. Lochmann Consulting Gmbh
Frankfurt, Allemagne
 
 
À
29/03/2007 07:45:42
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
01209324
Message ID:
01209674
Vues:
19
>
>>**************************************************
>>oForm = Createobject('frmBase')
>>oForm.Show(1)
....
>>**************************************************
>>
>
>I'd eliminate all that "Do you really want to close down" stuff unless something really terrible will happen if you close the form accidentally. It's just excess baggage.
>
>Tamar

Hi Tamar,

many thanks, that you take care - you are perfectly right, Tamar: It does not make any sense, to interrogate each response of a user. Yet there might be situations, when this is useful.

Just to come back to the original purpose of this thread: Steven Rebello wanted to know how to run some code, when the form is being exited. So I send him a testbed, which might allow him to test various possibilities. I left out the Destroy method (Victor Anderson proposed it later), because it is a "one go, no return" thing. So Steven can check whatever fits his needs.

As said: I agree with you that, if closing a form will do no harm, it does not make any sense to annoy a user by asking him/her, whether she/he knows, what he/she is doing right now. I am working on an application, which serves to administer a group of self employed sales persons. Each one is responsible for a larger group of "sales targets". So there is quite some questioning of the database. When this is done and the respective form is closed, it indeed does not make any sense to get a confirmation from the user whether he/she really wants to close the form.

But some data entry into this database is done by persons, who at the same time answer phone calls (the data entry is supposed to fill the sometimes rather lengthy pauses between these calls). So when a user has been taking a phone call while in the middle of entering a set of data and then wants to exit the form, it might be advisable to check, whether the data entry is complete and saved or not. If the check will yield an incomplete or unsaved data entry, then the user should be given the choice either to finish the data entry or abort the data entry.

The testbed can easily be manipulated to check out, how to proceed and how to code without the overhead of all of the other code of the later form.

Hoping to meet you sometimes at a DevCon

Hans
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform