Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Detecting a validation failure of child by grandparent c
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Versions des environnements
Visual FoxPro:
VFP 6 SP5
Divers
Thread ID:
01092783
Message ID:
01093225
Vues:
24
If iLayer and myLayer are subclasses from aLayer, when how can the parent class know about its children? I think it's impossible.

Also, I believe there is a slight problem in the Save or it's a typo:

>IF NOT THIS.BeforeSave()
> RETURN .F.
>ENDIF


>Hi David
>
>>Is there an explicit call to cForm.Save() like you have posted? If so it looks out of place.
>
>No, it is the save method that has calls to BeforeSave() and AfterSave() with it's own working inbetween. But all of this is in the cLayer framework layer which I do not touch. But I have equivalant Save(), BeforeSave() and AfterSave() available in the iLayer, aLayer and MyLayer. As you may well be aware of the old codebook methodology I can modify the iLayer for all my applications use. aLayer and MyLayer are application specific. Now I wanted to catch a failure in aLayer and MyLayer in the iLayer. But all I have been able to be successful is catch the cLayers failures in iLayer due I, my guess the placement of DODEFAULT()s.
>
>This is the untouchable cLayer's cForm.Save()
>
>IF NOT THIS.BeforeSave()
>   RETURN
>ENDIF
>
>*** save stuff here
>
>THIS.AfterSave()
>
>
>This is the framework customization iLayer's iForm.BeforeSave() (as updated by Naomi) and where I am only able to catch the codebook cLayer errors. My intention is to catch MyLayer and aLayer errors here.
>iForm.BeforeSave()
>
LOCAL llRetVal, lcErrorMsg
>
>llRetVal   = DODEFAULT()
>if not m.llRetVal
>lcErrorMsg = THIS.oBizObj.GetErrorMsg()
>
>IF NOT EMPTY(lcErrorMsg)
>	THIS.DisplayErrorMsg(lcErrorMsg)
>ELSE
>	THIS.DisplayErrorMsg("The record has not been saved." + CHR(13) + CHR(10) ;
>			+ "Please provide the required details and try saving again")
>ENDIF
>
>endif
>RETURN llRetVal
>
>
>This is the app specific MyForms.BeforeSave()
>
llRetVal = DODEFAULT()
>llRetVal = llRetVal AND THISFORM.pgf.Page1.txtIno.CheckForBadNextNo()
>
>IF llRetVal
>*** my stuff where somewhere it fails and llRetVal = .F.
>ENDIF
>
>RETURN llRetVal
>
>
>Hope I am able to pass on my intentions clearly.
If it's not broken, fix it until it is.


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

Click here to load this message in the networking platform