Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Acopy() and myArray_assign()
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00887723
Message ID:
00888007
Views:
12
Hey Bill,

Unfortunately I can not make acopy trigger the assign, so I can not help you further :(

This is the code I tried:
clear
loMyClass=Createobject('myClass')
loMyClass.myMethod()


define class myClass as custom

	dimension myArray(1)

	procedure myArray_assign(vNewVal, m.nIndex1, m.nIndex2)
		this.myArray[m.nIndex1, m.nIndex2] = transform(m.vNewVal)
	endfunc
	
	procedure myArray_access(m.nIndex1, m.nIndex2)
		return this.myArray[m.nIndex1, m.nIndex2]
	endfunc

	procedure myMethod()
		local la(4, 2), i, j

		for i=1 to 4
			for j=1 to 2
				la[i, j] = 10*i + j
			next j
		next i

		acopy(la, this.myArray)		&& myArray_Assign not triggered
		
		this.myArray[1,2]=25			&& myArray_assign correctly triggered
		
		for i=1 to 4
			for j=1 to 2
				? this.myArray[i, j], Vartype(this.myArray[i, j])
			next j
		next i
		
	endfunc
enddefine
By the way, if I do not do the
dimension myArray(1)
and put your code instead
myArray(1,1) = ''
I got an error in the acopy saying that this.myArray is not an array....

Hugo
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform