Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP 8 Empty Class
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00793345
Message ID:
00793637
Views:
30
>>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform