Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Properties
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00189168
Message ID:
00189298
Views:
9
Just an observation:
If I understand correctly, if the Assign method affects other objects, it could prove to be a tricky bug to find for someone who is not aware of the method.

I do have a question:
The example you gave,
ThisForm.BackColor = "RED"
would produce an error in VFP 3.0 (improper data type or something). Would the Assign method intercept the assignment command and actually override what it does and therefore avoid the error?

Also, does every propery of every object have Assign and Access methods?

Sorry, I don't have VFP 6.0 yet, so I can't answer these questions myself...

Thanks,
Joe


>>I have notice in vfp60 when you create a property there are assign method and access method can some one show me how to use this. We did not have this vfp50 so at this time I am not utilizing these new procedures. Is this good thing or a bad thing.
>
>Randy,
>
>Assign and Access methods are new to VFP 6.0. They are neither good or bad in themselves but are of value based on their use. Using one of them adds a method call to the proper6ties reference. An assign method is fired whenever a value is assigned to its respective property and an access method fires when the value of the property is read.
>
>For example, assume a property of a fomr named MyProp with both an assign and access method;
>
>
>Thisform.MyProp = "ABC" && fires the assign method
>WAIT WINDOW Thisform.MyProp && fires the access method
>
>
>You can use these for a number of different purposes. Perhaps it is important to change other properties when one gets changed. The assign method will allow you to do this without requiring that a method is called explicitly. You simply assign a value to the property and in its assign method you deal with all the other properties that require changes.
>
>Another example might be that for the prupose of simplifying some code you want to store the color number for something in a property allowing the code to simply use the property without converting it. However you want to assign the color using the color names so the code looks like ThisForm.BackColor = "RED". You can do this using an Assign method. The assign emthod receives the value being assigned. You can take "RED" and convert it to the appropriate RGB() call and assign the RGB() return value to the property.
Joseph C. Kempel
Systems Analyst/Programmer
JNC
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform