Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
OCollection_ASSIGN Problem
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01219959
Message ID:
01285935
Views:
19
Would this work for you?
DEFINE CLASS Col AS Collection
  lAllowLoad = .T.
  PROCEDURE Add(eItem, cKey, eBeforere, eAfter)
    IF NOT This.lAllowLoad
      ERROR 1740
    ENDIF
    ...
  ENDPROC
ENDDEFINE
>
>I want to follow up on this:
>
>
>
>PROCEDURE LoadInvoices
>
>This.oInvoices = CREATEOBJECT("Col")
>
>SELECT *;
>	FROM Invoices;
>	WHERE CustomerId = iCustomerId;
>	INTO CURSOR Temp1
>
>SELECT Temp1
>SCAN
>
>	oInvoice = CREATEOBJECT("Invoice", Temp1.InvoiceId)
>	
>	** Add the invoice object to the collection
>	This.oInvoices.Add(oInvoice)
>
>ENDSCAN
>
>RETURN
>
>
>DEFINE CLASS Col AS Collection
>	PROCEDURE Add(eItem, cKey, eBeforere, eAfter)
>	ENDPROC
>ENDDEFINE
>
>
>
>The question is how do I make the collection property read-only AFTER I have loaded it.
>
>I considered defining a public variable "goAllowLoad" in the LoadInvoices and then check
>to see of it's defined in the Add method of the collection, and if not, throw error 1740
>("name" is a read-only property), but this seems ugly to me.
>
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform