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:
00793658
Views:
23
>>>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
>
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?
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