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?
 Anil Tayal
 To: Andy Kramek
  Where is Andy Kramek?
 Hot Springs Village
 Arkansas - United States
 Andy Kramek
Subject: Thanx a lot Sir
Thread ID: 50678 Message ID: 50774 # Views: 1 # Ratings: 0
Version: Visual FoxPro 6 Category: Classes and Objects
Date: Monday, September 06, 2004 8:13:21 AM         

> Hi Anil
> > 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
> Nope! You cannot pass a property (of any sort) by reference, only by value.
> There are two options:
> [1] Pass a reference to the object itself and let the called routine access the property
> FillValues( This )

> [2] Copy the array to a variable and pass that by reference:
> ACOPY( This.aValues, laVals )
> FillValues( @laVals )
> ACOPY( laVals, This.aValues )

> And just as a by-the-way, there is no need to use SET UDFPARMS just to pass a value by reference, prefixing the name with the "@" sign does it.
> In fact you really should not use SET UDFPARMS like this because it is a global setting and can affect the way in which certain native functions behave. That means that your called routine may not behave as you expected!
> Regards
> Andy Kramek
> Microsoft MVP (Visual FoxPro)
> Akron, OH, USA

Thanks a lot Sir . Its an honor that I got a reply from you. I am a great fan of yours. I have read all your kit box articles published in foxtalk (only the free ones, because the subscription is out of my reach). After reading them I have also tried my hands at creating various useful control classes and I have fallen in love with VFP.




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