Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BindEvent() Why does it not work with the Error-event ?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00947460
Message ID:
00948265
Views:
22
Hi RInse,

It's documented in the BINDEVENT() Function help, that "Certain events such as When and Valid require code in the event for it to occur". It looks like ERROR() method is one of such events. Add some code to the ERROR() event and you'll see that binding works
	Procedure Error
		Lparameters lxPara1, lxPara2, lxPara3
                * Wait Window PROGRAM()
	Endproc

	Procedure ErrorHandler
		Lparameters lxPara1, lxPara2, lxPara3
		Wait Window PROGRAM()
	Endproc
>*
>* below the sample-code from the VFP-helpfile for the BindEvent() method.
>*
>* the sample is extended with a error-handler wich should not be active
>* if the code is executed in development-envoirement.
>*
>* why is this not working ?
>*
>* R.Lemstra@xso.nl
>
>
>Public oHandler
>oHandler=Newobject("myhandler")
>Do (_Browser)
>Bindevent(_Screen,"Resize",oHandler,"myresize")
>
>* uncomment te line below to check if the 'ErrorHandler'
>* is correctly assigned to the error-method
>*
>* oHandler.Error()
>
>
>Define Class myhandler As Session
>	
>	Procedure Init
>*		IF _VFP.StartMode # 0
>			Bindevent(This,"Error",This,"ErrorHandler")
>*		endif
>	Endproc
>
>	Procedure myresize
>		If Isnull(_obrowser) Then
>			Unbindevent(This)
>		Else
>			_obrowser.Left = _Screen.Width - _obrowser.Width
>		ENDIF
>
>		ERROR 12
>
>		Return
>	Endproc
>
>* uncomment the lines below to check the behaviour
>* if the error-method was assigned corretly
>*
>*	Procedure Error
>*		Lparameters lxPara1, lxPara2, lxPara3
>*		Wait Window 'Error'
>*	Endproc
>
>	Procedure ErrorHandler
>		Lparameters lxPara1, lxPara2, lxPara3
>		Wait Window 'Error'
>	Endproc
>
>Enddefine
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform