Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP 8 Empty Class
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00793345
Message ID:
00793637
Vues:
29
>>Thanks Ken
>>
>>So if I understand this then, the only benefit from using the Empty
>>class with SCATTER is the ability to add properties. There is no way
>>to add methods?
>
>THis is kind of hokey, but you can bind an event to fire a method by changing a property in the empty object. Paste the following code in a PRG and run it:
>LOCAL o, x
>o = NEWOBJECT('Empty')
>ADDPROPERTY(o, 'FireInit')
>x = NEWOBJECT('EmptyMethods')
>BINDEVENT(o, 'FireInit', x, 'FireInit')
>CLEAR
>o.FireInit = .t.
>
>DEFINE CLASS EmptyMethods AS Custom
>
>	PROCEDURE FireInit
>		WAIT WINDOW NOWAIT 'FireInit fired'
>	ENDPROC
>	PROCEDURE Release
>		RELEASE THIS
>	ENDPROC
>
>ENDDEFINE
>
Cool!

You can have one class for methods and a miriad of props only classes that use it :-)
If we exchange an apple, we both get an apple.
But if we exchange an idea, we both get 2 ideas, cool...


Gérald Santerre
Independant programmer - internet or intranet stuff - always looking for contracts big or small :)
http://www.siteintranet.qc.ca
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform