Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Passing object array
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01668317
Message ID:
01668323
Views:
76
I'm confused as to what's happening here with this code that is a little different that Rick S.'s code. I'm making the original array a LOCAL and I rebuild the loObj a second time and use "aItems[2]" instead of "aItems[1]".

When I run it through the debugger and step into the CallMethod and examine all the variables "loObj" in that method, I got .aItems[1]='Rick' and .aItems[2]='Rick'. I was expecting to see 'Markus' to be in .aItems[2] during in the 2nd call.

local laItems[2],x

laItems[1] = "Rick"
laItems[2] = "Markus"
*******************************First Call
loObj = CREATE("Empty")
ADDPROPERTY(loObj,"aItems[1]",laItems)
SET STEP ON
x= CallMethod(loObj)
?x

loObj = .null.
release loObj

*******************************Second Call
loObj = CREATE("Empty")
ADDPROPERTY(loObj,"aItems[2]",laItems)
SET STEP ON
x= CallMethod(loObj)
?x


RETURN

FUNCTION CallMethod(loObj)
local x as Object
x = loObj.aItems[1]
try
?x
catch
endtry

return x
*return loObj.aItems[1]
ENDFUNC
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform