Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Prg Reads but doesnot write form property
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00738120
Message ID:
00738133
Views:
24
Gerard,

VFP always passes properties by value. Passing property by reference would breake object encapsulation. Property isn't just a variable attached to the object, it's a part of the object. For example, if property has Access and Assign methods you can only read/write property through those methods. You don't have direct access to the property anymore because reading from/writing to property internaly is converted to calls to Access/Assign methods.
If you've to pass property by reference, array property for example, you can use memory variable as intermediary.

>Hi.
>I have a simple .prg as follows:
>-------------------------
>Tempprg.prg
>Parameters X
>x=x+1
>Return
>------------------------
>
>If I run following:
>a=5
>Do Tempprg with a -----> Returns 6 Fine
>
>If I do the following in a form:
>Do tempprg with Thisform.Mya (Mya=5)
>..... Thisform.Mya remains as 5
>
>Why is this happening. It happens irrespective of UDFPARMS setting
>It is definitely picking up the Propery value of 5 within the
> prg routine(I have a wait in),
> but is not writing the updated value back to the property.
>
>No I know I can change the .prg into a Method of the form, but I am curious as to why the above code does not work .
>
>Regards,
>
>Gerard
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform