Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Text_Access method.
Message
From
11/10/2001 11:55:50
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00566997
Message ID:
00567044
Views:
18
The access methods can, indeed, be confusing. An alternative, that would make it clearer to another programmer, what is going on, would be to create your own methods, which you might name TxtPath.SetValue(), and TxtPath.GetValue().

However, I think there is nothing basically wrong with using _access and _assign to change a property value. For instance, this allows you to change a property type, without having to search through your entire code.

Hilmar.

>I was just wondering which way is proper, and how another programmer might expect it to work. For example:
>
>
with txtPath
>    .value = "c:\SomeFolder\SomeOtherFolder"
>    ** The value_assign fires and changes the passed value to "c:\...\SomeOtherFolder"
>
>    x = .value
>    ** The value_access fires, retrieves the real value and returns "c:\SomeFolder\SomeOtherFolder"
>
>    x = .text
>    ** Should this return "c:\SomeFolder\SomeOtherFolder" or "c:\...\SomeOtherFolder"?
>endwith
>
>
>>>I have a text box class with an value_access and value_assign method that formats the text that gets displayed in the textbox. It is for displaying a folder path and it chops the string down so it fits in the textbox.
>>>
>>>The value_assign stores the real value in a custom prop, chops the string, and passes it on.
>>>
>>>The value_access retrieves the real value, and returns that.
>>>
>>>My question is should I add a text_access method that retrieves the true value or should text retrieve the displayed (chopped) value?
>>
>>Whatever you want to return. If you have an _assign method, you may, or may not, want to also have an _access method, depending on your needs.
>>
>>If it pleases you to get a property "as is", you don't need an _access method. If you want additional processing done, you can add the _access method.
>>
>>Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform