Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Assign method problem
Message
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00381071
Message ID:
00381422
Views:
20
>>>Why not just put the validation code in the SetMyProp() method and lose the ASSIGN?
>>
>>Roi,
>>
>>1) because, at this point, I am testing to see the idiosyncracies of _access and _assign methods
>>2) because when I actually implement this - the SetMyProp() method may not be the only thing that can change the value - I don't know - so I'm looking to code it at the lowest level. I also may end up doing it as you suggested.
>>
>>thanks,
>>Ken
>
>Ken,
>PMFJI, but I see two ways to go about this.
>
>Technique 1
>Property is public and there is a corresponding _Assign method.
>
>With this technique, you don't have to worry about much, the VFP engine will take of it. Whenever the property is assigned by anything (internal or external code) the validation in the _Assign will fire and do the appropriate thing.
>
>Technique 2
>Property is private and there is a corresponding wrapper function to assign it.
>
>With this technique, you don't need the _Assign method because everything has to go through the qrapper function to assign so the validation code can go there. Having both would be redundant.
>
>Personally, I haven't found a use for hidden properties. Because I work with frameworks and creating generic code, most of my stuff will be subclassed and I would lose those properties.

Larry,

These are good and valid points. There are exceptions, however. I've been working on what I refer to as the "OLE Automation Server from Hell". This is where I originally intended on doing was to present an entry point for the assignment of multiple values. In order to keep the external interface "clean", I made the decision to keep the necessary properties hidden. I had trusted that my _Assigns would then handle the validation. Certainly, I could've created wrapper functions to handle each of the assignments, but this seemed to be a perfect use for the _Assign events. Unfortunately, as I learned, you can't.
George

Ubi caritas et amor, deus ibi est
Previous
Reply
Map
View

Click here to load this message in the networking platform