Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Reset Properties Values
Message
From
16/11/2010 14:47:40
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01489238
Message ID:
01489248
Views:
81
This message has been marked as a message which has helped to the initial question of the thread.
>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.

Since it's all in a prg, and it's your custom class, you can simply have a method which will set the properties to whatever you want. You can then call that from the .init() and whenever you want. Something like
define class mycustom as custom
prop1=""
prop2=""
...
propX={}

procedure initProps()
with this
	.prop1="something"
	.prop2="whatever2"
...
	.propX=date()
endwith

procedure init()
this.initProps()
Then later in code just lo.InitProps()

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform