Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Properties
Message
 
To
19/02/1999 02:12:34
Randy Hooper
Ranco Business Software
Tampa, Florida, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00189168
Message ID:
00189197
Views:
11
>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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform