Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Reset Properties Values
Message
De
16/11/2010 14:47:40
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01489238
Message ID:
01489248
Vues:
83
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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform