Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to make Memory variables use Private Data Sessions
Message
From
16/11/2001 09:21:25
 
 
To
15/11/2001 23:37:12
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00580254
Message ID:
00582674
Views:
56
Hello David,

Oops, you are correct. This is actually one of the reasons SCATTER works better than ADDPROPERTY() for this situation.

Here is a small example showing the problem of using a name field while using ADDPROPERTY().

Thanks for correcting me!
create cursor test (testID i, name c(20), height n(5,2))

oTest = createObject("oRecord","test")

? oTest.ofields.name
oTest.ofields.name = "Smith"
? oTest.oFields.name    && crash and burn here...we have renamed the object

define class oRecord as custom

    procedure init
    lparameters lcAlias
        local laFields, lnFields, i
        dimension lafields[1]
        this.addobject("oFields","dfields")

        select (lcAlias)
        lnfields = afields(laFields)
        for i = 1 to lnfields   && add property for each field to custom object
            this.ofields.addproperty(laFields[i,1]) 
            ? lafields(i, 1)
        next i

    endproc

enddefine

define class dFields as custom

enddefine
>Hi Steve,
>The object created by SCATTER NAME has no properties at all other than the field names. So having a field "Name" works ok.
>As far as I know every other Fox object has a "name" property.
>
Steve Gibson
Previous
Reply
Map
View

Click here to load this message in the networking platform