Hi guys,
I have a class defined in a PRG, derived from Custom object with several user-defined properties.
How I can make a method that I reset the value of each property with the value they had when you instantiate the class?
I've tried
Object.ResetToDefault(Property), but to be user-defined properties, all take the value
.F.I made a method instantiating a new object and copying the values of the properties defined by the user, although it works well, this is not to my liking.
PROCEDURE ResetProperties()
LOCAL lo, ln, la(1), lcProp
lo = CREATEOBJECT(THIS.NAME)
FOR ln = 1 TO AMEMBERS(la, lo)
lcProp = "This." + la(ln)
IF PEMSTATUS(lo,la(ln),4) AND ;
PEMSTATUS(lo,la(ln),3) = "Property" AND ;
NOT PEMSTATUS(lo,la(ln),2) AND ;
TYPE(lcProp) $ "NLC"
&lcProp = EVALUATE("lo." + la(ln))
ENDIF
ENDFOR
lo = NULL
ENDPROC
Is there a better way or more elegant?
Thanks
Luis María Guayán
Tucumán, Argentina
________________________________
SysOp de
www.PortalFox.comNada corre como un zorro
________________________________