Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Anil Tayal
  Where is Anil Tayal?
 Delhi
 India
 Anil Tayal
 To: Eric den Doop
  Where is Eric den Doop?
 Houten
 Netherlands
 Eric den Doop
 Tags
Subject: RE: Passing array from a class to a UDF
Thread ID: 50678 Message ID: 50680 # Views: 1 # Ratings: 0
Version: Visual FoxPro 6 Category: Classes and Objects
Date: Saturday, September 04, 2004 2:07:24 PM         
   


> > Hi friends,
> >
> > I recently came upon a problem. I have a class based on the combobox. It has an array property called aValues. The rowsource of the combobox is this array. In the INIT of the class I want to populate the array with values so I have to pass it to a UDF. I do as follows:
> >
> > proc MyCombo.INIT
> >
> > set udfparms to reference
> > fillvalues(.aValues)
> > endproc
> >
> >
> >
> > function fillvalues
> > param aVals
> >
> > aVals(1,1)=""
> > aVals(1,2)=0
> > ...
> >
> > endfunc
> >
> > but when I use this class on a form , all values of the combobox are just .F. It appears as it the array which was changed in the UDF was not the same array, inspite of setting set udfparms to reference. Please help.
> >
> > Thanks,
> >
> > Anil
>
>
> First thought: just pass the object instead of the array property:
>
> * combo.init
> fillvalues(this)
> FUNCTION FillValues(toCombo)
> 	toCombo.aVals[1,1] = ""
> 	toCombo.aVals[1,2] = 0
> ENDFUNC
> 

> --
> Eric den Doop
> www.foxite.com - The Home Of The Visual FoxPro Experts

Thanx a lot Eric. I know that there are workarounds available. I just wanted to know whether what I was doing should work or was I doing something wrong (just for knowledge sake).

Anil


ENTIRE THREAD

Passing array from a class to a UDF Posted by aktayal @ 9/4/2004 1:44:34 PM
RE: Passing array from a class to a UDF Posted by Eric den Doop @ 9/4/2004 1:56:05 PM
RE: Passing array from a class to a UDF Posted by aktayal @ 9/4/2004 2:07:24 PM
RE: Passing array from a class to a UDF Posted by Andy Kramek @ 9/5/2004 2:30:00 PM
Thanx a lot Sir Posted by aktayal @ 9/6/2004 8:13:21 AM
RE: Thanx a lot Sir Posted by Andy Kramek @ 9/6/2004 1:10:21 PM