Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BINDEVENT Gotcha!
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00823477
Message ID:
01221632
Views:
20
>>>In case you missed it in another thread here today, there is a Gotcha in using a BINDEVENT for an event where VFP passes parameters to. Take the MouseMove event for example. Edit the MouseMove, and you see a parameter statement:
>>>
>>>LPARAMETERS nButton, nShift, nXCoord, nYCoord
>>>
>>>So, when you BINDEVENT any event to which VFP passes parameters, the delegate method or procedure needs to lead with a parameter statement with the same number of parameters. So the MyMouseMove code in the BINDEVENT example below must have a parameter statement in order to avoid an error:
>>>BINDEVENT(THIS, 'MouseMove', THISFORM, 'MyMouseMove')
>>>BTW, this is documented in the VFP Help CHM file.
>>
>>How come this is a Gotcha if it's documented? :)
>
>I think it is not documented <g> At least I didn't find it yesterday in the Help.

From Help :)
cDelegate
Specifies the method, or "delegate", that handles the event for oEventHandler.

The delegate method must have the same parameters as the event specified in cEvent.
You can call the AEVENTS( ) function to retrieve an object reference to the event
source. If the delegate method does not have enough parameters to handle those passed
by the event, Visual FoxPro generates an error.
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform