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:
00793660
Views:
32
>So this does not work as expected!
>Change your code to assign 5 to the o.FireInit instead of .t.
>
>The bindevent fire, but you notice that its not a numeric value...
>
>My conclusion is that the event fire only on the assignment "BINDEVENT(o, 'FireInit', x, 'FireInit')"
>and not on subsequent changes of the property value.
>
>Comments?

The part about it not going into an endless loop indeed did surprise me. However, I will not count on this behaviour as the potential for future releases of VFP might "fix" this. This may, however, be the actual design behaviour by the VFP Team. Of that, I am not sure. I am glad that the current behaviour prevents such a disaster.

As long as you are setting the property outside the method, the method will fire every time. The following does fire the method all 3 times
PRIVATE o, x
o = NEWOBJECT('Empty')
ADDPROPERTY(o, 'FireInit')
x = NEWOBJECT('EmptyMethods')
BINDEVENT(o, 'FireInit', x, 'FireInit')
CLEAR
o.FireInit = 1
o.FireInit = 2
o.FireInit = 3


DEFINE CLASS EmptyMethods AS Custom

	PROCEDURE FireInit
*!*			IF TYPE('o.FireInit') = "N"
*!*				o.FireInit = o.FireInit + 1
*!*			ELSE
*!*				o.FireInit = 1
*!*			ENDIF
		WAIT WINDOW 'FireInit fired - ' + TRANSFORM(o.FireInit)
	ENDPROC
	PROCEDURE Release
		RELEASE THIS
	ENDPROC

ENDDEFINE
Mark McCasland
Midlothian, TX USA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform