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:
01243998
Views:
18
>>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? :)

Hehe! Just saw this after months away. Poor choice of words in the subject. It's really something that will bite you because who reads Help files?

For those of us who have builders that build classes with hooks, we have to put in "extra" code to remind us when we use these hooks to look at the parent method code to see what parameters we are accepting or what a native method requires when that method is hooked to a delegate method.
Mark McCasland
Midlothian, TX USA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform