Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sometimes I want to release form other I don't
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00498494
Message ID:
00498625
Vues:
8
>>>Hi,
>>>
>>>I have a form, with the "X" in upper right corner. When cliccing on that forms released - thats fine
>>>
>>>Some times a special condition is there, and then I want a special warning to be displayed - and then prevent releasing.
>>>
>>>If I put the messagebox() in the destroy method - it displays - but I can't figure out HOW to prevent the form from closing
>>>
>>>I know I can disable the "X" perhaps via a timer - but that does not give the message to help the user.
>>>
>>>There is no valid for that condition.
>>>
>>>In short is it possible to prevent a release of a form - like returning an F in the INIT - or Valid
>>>
>>>Thanks in advance
>>>
>>>Lasse
>>>
>>>PS: a DO Form in the destroy does actually the job - but I doubt that's a good solution
>>

>>Look in the queryunload event of the form.
>>There you can place your messagebox code.
>>If you want to stop the releasing of the form then after the messageboxe is shown, you can issue nodefault which stops the form from unloading
>
>Hi Ko Visse,
>
>Thanks for your advice. I have been looking through the manual and the VFP help, but have found no info about this.
>
>Thanks
>
>Lasse
Hi Lasse... The man's right!! QueryUnload is an event on the form. If you code it as something like this...
lnReply = MessageBox("Close window?", 36, "Check For Close")
If lnReply = 6 && User said Yes - do nothing... let window close
Else
NoDefault && User said No - so BYPASS the QueryUnload's Default behavior.
EndIf

Another approach is to use your "special case" to set the window's Closable property to .F. ...
This code could go in the form's Init() or some other control's Valid(), depending on what the
special condition is...

If (special case is .T.)
ThisForm.Closable = .F.
EndIf

Regards, ~~ David B. ~~
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform