Expert help requested -passing class properties to UDFs by reference 
Author Message
 Expert help requested -passing class properties to UDFs by reference

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



Mon, 14 Feb 2000 03:00:00 GMT  
 Expert help requested -passing class properties to UDFs by reference

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



Wed, 23 Feb 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Expert help requested -passing class properties to UDFs by reference

2. ?? Pass property by reference

3. Form array properties: passing by reference

4. Passing an object's property by reference

5. Referencing Class Properties

6. Pass Property Value to Form Class?

7. passing arrays to udfs

8. Help with ActiveX control property references

9. HELP: Form width and minwidth property problems in Class Designer for VFP3

10. passing parameters by reference

11. Page References in Answers (was re: passing parameters to screens)

12. Pass Array by Reference to Form?

 

 
Powered by phpBB® Forum Software