Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Collection Default ITEM method
Message
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Collection Default ITEM method
Miscellaneous
Thread ID:
00735202
Message ID:
00735202
Views:
42
Hi All,

Since the MS VFP8 feedback page seems to be down, I'll post this here.

Seems the default method of the collection class passes only the first parameter to the ITEM() method. This is unfortunate, but I don't know if it's a bug or an ER.

I've a number of examples where I'd want to extend the item() method a bit, and it would be nice to still be able to use the default method syntax.

One such example is below.

Best,
-lc

PS: And, if anyone can tell me how to colorize the VFP code on this site, I'd be much obliged. Seems like something one would find under the "help" tab, but I sure couldn't...


*-- just messing around with collections

o=createobject("csnwVector")

o.dimension(200,65000)
? o.item(1,2) && works, returns 0
? o(1,2) && fails, the default method does not pass the second param


define class csnwVector as Collection
* for large arrays (over the 65000 limit)
* a collection of arrays to provide a place for a
* large vector in Rn
* A cursor would probably work better for this...

nInitValue = 0

function newRow( tnCols )
local loRow, laVals
loRow = createobject("empty")
addproperty( lorow, [aVals(1)], NULL )
dimension lorow.aVals(tnCols)
store this.nInitValue to lorow.aVals
return loRow
endfunc

function dimension( tnRows, tnCols )
local lnK
for lnK = 1 to tnRows
this.Add( this.newRow( tnCols ) )
endfor
endfunc

function item( tnRow,tnCol )
nodefault
loRow = dodefault( tnRow )
return loRow.aVals(tnCol)
endfunc

enddefine
<\pre>
-lc
Next
Reply
Map
View

Click here to load this message in the networking platform