Message
 
 
To
10/03/2010 16:20:48
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Fórum:
Visual FoxPro
Category:
Programação, sintaxe e comandos
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
ID da thread:
01453599
ID da mensagem:
01453827
Views:
51
>>>Create a class "Datamapper" as custom, that has on property and two methods:
>>>DataMapper.Aliasname
>>>dataMapper.Getvalue()
>>>datamapper.setvalue()
>>>
>>>The getValue() method is as follows:
>>>
>>>LPARAMETERS tcFieldname
>>>RETURN EVALUATE(THIS.Aliasname + "." + tcFieldname)
>>>
>>>
>>>and the setvalue() method is as follows:
>>>
>>>LPARAMETERS tcFieldname, tvValue
>>>REPLACE (tcfieldname) WITH tvvalue IN (THIS.AliasName)
>>>
>>>
>>>In your form, do the following code:
>>>
>>>MainapplicationObject.NEWOBJECT("Datamapper","Datamapper","LibraryWhereDatamapperexist")
>>>MainapplicationObject.Datamapper.Aliasname = ??? *you should know the aliasname here.
>>>MyValue = MainapplicationObject.Datamapper.GetValue("MyField")
>>>
>>>
>>>What do you think?
>>>
>>
>>Yes, I like the idea - looks like it will work well - how this design pattern is called?
>
>
>Oh my and you were saying that wouldn't touch application object class anyway:) You succeeded to confuse me.
>Cetin

This method doesn't require any changes of the existing method's code in the application object.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Responder
Mapa
View