Expert help requested -passing class properties to UDFs by reference

Expert help requested -passing class properties to UDFs by reference

Post by Geoff Davis » Fri, 29 Aug 1997 04:00:00



I have a number of routines which I have written to perform various
useful functions in VFP5a eg.

FUNCTION ARTRIM
        && trims all leading and trailing spaces from any element in
        && the array which is a character expression
        PARAMETER tArray
        LOCAL lnCnt
        FOR lnCnt =1 TO ALEN(tArray)
                IF TYPE("tArray(lnCnt)")="C"
                        tArray(lnCnt)=ALLTRIM(tArray(lnCnt))
                ENDIF
        ENDFOR

To use this function you have to pass it the array name by reference
eg.

DIMENSION laTest(3)
laTest(1)="  Trim both     "
laTest(2)="Trim trailers   "
laTest(3)="      Trim leaders"


This works very well however when I tried this with a class property
in a method it wont work at all!

eg.


cuases the error "Alias 'this' not found"

or

SET UDFPARMS TO REFERENCE
=ARTRIM(this.testArray)
SET UDFPARMS TO VALUE

causes the error "tArray is not an array"

has anyone any idea how to achieve the same sort of functionality
using properties?


Note: the email address supplied above has been altered
to help reduce junk e-mails.  Remove the underscores before
replying if you wish to send me a genuine e-mail

 
 
 

Expert help requested -passing class properties to UDFs by reference

Post by David Frankenbac » Sun, 07 Sep 1997 04:00:00


Geoff,

You have to ACOPY the property to a local array, process it and copy it back. The performance is not quite as
bad as it sounds.

df  - (MVP FoxPro) http://www.geocities.com/ResearchTriangle/9834/


Quote:> I have a number of routines which I have written to perform various
> useful functions in VFP5a eg.

> FUNCTION ARTRIM
>    && trims all leading and trailing spaces from any element in
>    && the array which is a character expression
>    PARAMETER tArray
>    LOCAL lnCnt
>    FOR lnCnt =1 TO ALEN(tArray)
>            IF TYPE("tArray(lnCnt)")="C"
>                    tArray(lnCnt)=ALLTRIM(tArray(lnCnt))
>            ENDIF
>    ENDFOR

> To use this function you have to pass it the array name by reference


 
 
 

1. Referencing Class Properties

Andrew:  Check that you are referencing the properties correctly. Are
both properties showing in the same location/base class?  

Also, what is the exact error # - that may help.  

Are you sure you that "this.parent.parent" is correct for both
properties?

And, of course, the most common error - bad typing.  Double check the
original properties in the class to be sure they are 'CustomA' and
'CustomB'  

Finally, try referencing them with their full names:  
Myform.pageframe1.customA = 1

Hope one of these ideas helps.
Barbara Paltiel
******************************************

2. Create a DATABASE using the "Create Database ..." cmd

3. Form array properties: passing by reference

4. Foxpro 2.6 for windows and OS/2 warp

5. Requesting of properties from different levels via DIMENSION PROPERTIES

6. How to retrieve info from an insert SQL statement

7. Passing Classes to other classes (using user defined types)

8. contains and Containstable

9. passing arrays to udfs

10. Need help passing a reference

11. SQL 6.5 Expert requested pls!

12. Request SQL*Net Experts

13. wanted: references on "Expert Databases"