Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SendChildMessage()
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
The Mere Mortals Framework
Divers
Thread ID:
00666695
Message ID:
00666776
Vues:
23
Nerissa,

>Is this method intentionally coded to expect only a boolean returned value in line 46 which says "IF NOT llRetVal"? I tried to send a "Delete" message to the child business object using this method from the parent business object kbizobj.delete(). But delete() is returning a numeric value which causes a "Data type mismatch" error.

I've been thinking this one through with another Mere Mortals developer via private e-mail. I originally designed the method to expect a boolean return value...this allows any child object to return a .F. in order to stop any further processing. However, I'm thinking of modifying it to the following code which checks the type of the return value before checking its value. How would this work for you?
LPARAMETERS tcMessage, tuParm

LOCAL lnObjCount, lnCount, loChildBizObj, luRetVal, lcMessageCall

IF TYPE("This.RefBizObj") == "O"
	
	*--- Get the number of child objects ---*
	lnObjCount = This.RefBizObj.GetObjectCount()

	*--- Build the message call ---*
	IF PCOUNT() = 1
		lcMessageCall = "loChildBizObj."+tcMessage+"()"
	ELSE
		lcMessageCall = "loChildBizObj."+tcMessage+"(tuParm)"
	ENDIF

	*--- Iterate through the child objects and send each one the message ---*
	FOR lnCount = 1 TO lnObjCount
		loChildBizObj = This.RefBizObj.Get(lnCount)
		IF PEMSTATUS(loChildBizObj, tcMessage, 5)
			luRetVal = &lcMessageCall
			IF VARTYPE(luRetVal) == "L" AND NOT luRetVal
				EXIT
			ENDIF
		ENDIF
	ENDFOR
ENDIF

RETURN luRetVal
Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform