Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Detect QueryUnload
Message
 
 
À
16/06/2005 10:26:55
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01023802
Message ID:
01023971
Vues:
9
>>>>I use Lostfocus to Validate data in a Textbox and would not wish to validate if the user clicks on the QueryUnload to close a window. How do I detect this in VFP6 SP5 ? Bear in QueryUnload fires after Lostfocus and Mdown() always returns -1 if the Click is done on the Close Button or if the mouse is outside the active window ?
>>>
>>>You are better off, in my opinion, if you postpone all data validation until the user tries to save data. Then, you can give the user a list of conditions that are not fulfilled for saving the record.
>>
>>
>>********************************************************************
>>*  Description.......: CancelValidation
>>*  Calling Samples...:
>>*  Parameter List....:
>>*  Created by........: ideas by John Koziol /Cetin Basoz
>>*  Modified by.......: NN
>>********************************************************************
>>local llReturn, loObject
>>
>>loObject = SYS(1270) && Object under mouse
>>IF VARTYPE(m.loObject) = "O"
>>	llReturn = lower(justext(sys(1272, m.loObject))) = "cmdcancel" and mdown()
>>ELSE
>>    llReturn = .f.
>>endif    	
>>
>>return m.llReturn  or lastkey()= 46 or thisform.releasetype = 1 && Alt+C (shortcut for Cancel)
>>
>>
>
>And if you have two modeless open forms, both with cmdcancel button:
>- form1.textbox with focus
>- user click on the form2.cmdcancel .... form1 it is released!

The Cancel button doesn't release the form, it just Cancels validation, but I think you're right in your observation (I'm not sure I have a simple test case). How can you suggest to amend the above code to prevent this problem (very rear anyway)?
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform