Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
OCollection_ASSIGN Problem
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01219959
Message ID:
01285948
Vues:
22
I'm not sure there is good generic way to achive that. If you only want to prevent adding items after LoadInvoices than _Assign on lAllowLoad property should do the trick.
DEFINE CLASS Col AS Collection
	lAllowLoad = .T.
	PROCEDURE lAllowLoad_Assign(tlNewVal)
                * Do not allow to turn it on again 
		IF This.lAllowLoad AND NOT tlNewVal
			This.lAllowLoad = tlNewVal
		ENDIF
	ENDPROC
	PROCEDURE Add(eItem, cKey, eBeforere, eAfter)
	IF NOT This.lAllowLoad
		ERROR 1740
	ENDIF
	...
	ENDPROC
ENDDEFINE
>Sorry, I should elaborate more.
>
>I don't want developers using this class to be able to add items to the collection
>from outside LoadInvoices.
>
>Someone could do:
>
>
>
>oCustomer.LoadInvoices()
>oCustomer.oInvoices.lAllowLoad = .T.
>oCustomer.oInvoices.Add(...)
>
>
>See the problem?
>
>
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform