main logo
Subject: Re: BeforeSave() and AddToErrorMsg()
Author: Bhavbhuti Nathwani
Posted: 2002/04/10 00:20:20
 
View Entire Thread
New Search


Hi Ed,

Maybe I am getting excited about this prematurely, but here is what I noticed, the general psuedocode calls, for my problem, are as under:
<code>
boMAccounts.BeforeDelete()
cBizObj.BeforeDelete()
RETURN .T.

boMAccounts.AddToError()
RETURN
RETURN .F.

frmMAccounts1.Delete()
RETURN FILE_CANCEL

oFileDeleteBar.Click()

READ EVENTS
</code>

in similar circumstances the following code is executed in the Save() of the FORM whereas a corresponding code was not found in the step through of Delete()
<code>
CASE lnRetVal = FILE_CANCEL
*** EGL: 2001.12.31 17:09 - Added automatic display of any errors found in the process,
LOCAL lcErrorMsg
lcErrorMsg = This.oBizObj.GetErrorMsg()
IF NOT EMPTY(lcErrorMsg)
This.DisplayErrorMsg(lcErrorMsg)
ENDIF
RETURN lnRetVal
</code>

What I noticed different is that in case of delete there was no execution of the BOs Delete(), it went straight to the FORMs Delete(). And in case of the Save() there was first the execution of the BOs Save() which FILE_CANCELs to the FORMs Save() where the display of the error code is executed.

I checked my BO and the FORM for codes without DODEFAULT()s and I have found none. The BO has inherited from iBizObj, the FORM from iBizObjForm, as they should.

Please advise.

<i><font color="#663300"><i><font color="#663300">I am sorry to has misled you. I have a terrible Typo in there, the

This is the code in my bo_mAccounts in BeforeSave()

should read BeforeDelete(). The save stuff works alright.
Sorry again for the typo.</font></i>

My comments remain the same. The flow through Save() and BeforeSave() is identical to the flow through Delete() and BeforeDelete(). If BeforeDelete() returns .F., Delete() should return FILE_CANCEL, and the form should display the error message. If not, you need to step through the code to determine why. Typically, it is because a method is overridden without the proper calls to DODEFAULT(), or without properly passing the correct return values.
</font></i>

Regards
Bhavbhuti
 
©2002 Bhavbhuti Nathwani
<-- Prior Message New Search Next Message -->