Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Reset Properties Values
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Title:
Reset Properties Values
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01489238
Message ID:
01489238
Views:
115
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.com
Nada corre como un zorro
________________________________
Next
Reply
Map
View

Click here to load this message in the networking platform