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:
00793652
Views:
37
>>Just keep in mind you can not pass parameters or get back return values with BINDEVENT. However, you can handle this with setting other properties that the bound method can then use. The method in turn, can set other properties that can be read after the method fires.
>
>Question on this.
>
>If you bindevent to a property can you change the property from this event or you fall in a endless loop?

I changed the code as follows and ran it. The method only fired the original time.
PRIVATE 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
		IF TYPE('o.FireInit') = "N"
			o.FireInit = o.FireInit + 1
		ELSE
			o.FireInit = 1
		ENDIF
		WAIT WINDOW NOWAIT '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