CLEAR
o = CreateObject("myclass")
? o.myproperty
o.myproperty = 1
? o.myproperty
o.ResetToDefault("myproperty")
? o.myproperty
? o.myotherproperty
o.myotherproperty = SYS(2015)
? o.myotherproperty
o.ResetToDefault("myotherproperty")
? o.myotherproperty
?o.Height
o.Height = 1
?o.Height
o.ResetToDefault("Height")
?o.Height
o.addproperty("mythirdproperty",SECONDS())
?o.mythirdproperty
INKEY(0.2)
o.mythirdproperty = SECONDS()
?o.mythirdproperty
o.ResetToDefault("mythirdproperty")
?o.mythirdproperty
Define Class myclass as Custom
myproperty = 0
myotherproperty = SYS(2015)
ADD OBJECT default_keeper as custom
PROCEDURE Init
LOCAL ln,lni,la[1]
ln = AMEMBERS(la,This,0,'U')
FOR lni = 1 TO m.ln
This.default_keeper.AddProperty(m.la[m.lni],EVALUATE("This." + m.la[m.lni]))
NEXT
ENDPROC
PROCEDURE ResetToDefault
LPARAMETERS cProperty
IF PEMSTATUS(This.default_keeper,cProperty,5)
NODEFAULT
STORE EVALUATE("This.default_keeper."+cProperty) TO ("This."+cProperty)
ENDIF
ENDPROC
PROCEDURE AddProperty
LPARAMETERS cPropertyName, eNewValue, nVisiblity, cDescription
DO CASE
CASE PCOUNT() = 4
This.default_keeper.AddProperty(m.cPropertyName, m.eNewValue, m.nVisiblity, m.cDescription)
CASE PCOUNT() = 3
This.default_keeper.AddProperty(m.cPropertyName, m.eNewValue, m.nVisiblity)
CASE PCOUNT() = 2
This.default_keeper.AddProperty(m.cPropertyName, m.eNewValue)
OTHERWISE
This.default_keeper.AddProperty(m.cPropertyName)
ENDCASE
ENDPROC
EndDefine