Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Intellisense and other issues with DIMENSION in classes
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00592744
Message ID:
00593007
Views:
21
Hi Costas,

>I have used the following "trick" to make a friendly class with VFP7. However ASSIGN allows only character ot numeric parameters. Also it seems intellisense executes your code as you are typing a property name. Weird!
>
>* Class test in test.prg
>DEFINE CLASS test as session
>
>DIMENSION myprop(1)
>var1=''
>var2=''
>
>FUNCTION myprop_assign(elem, inx)
> this.var1=elem
> this.var2=inx
>ENDFUNC
>
>ENDDEFINE
>
>* Try this to test program
>*
>LOCAL xx as test of test.prg
>xx=CREATEOBJECT("test")
>xx.myProp(1)='abc' && Ok
>xx.myProp('abc')='xyz' && Ok
>xx.myprop(.f.)=123 && Error
>xx.myprop({1/1/2001})=123 && Error


Remember that you're not calling 'myprop_assign' event but trigger it by assigning a value to a myprop array element. The "weird" part is that VFP allows to use character expression as an array subscript value. The line
xx.myProp('abc')='xyz'
should geneate error because 'abc' isn't valid for the array subscript.
Also, the assign event for an array can have up to three parameters and the third one ( the column number) allows only numbers to be passed.

My guess would be, that VFP allows code like xx.myProp('abc')='xyz' that we could access the elements of array in the collections like manner or maybe even emulate collections with arrays.

>Also at the command prompt while you are typing:
>
>xx.myProp( <-- At this point Intellisense executes the code.

I don't see this when I run your code on my PC.

>
>Weird!
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform