Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Parameters of a delegate method in bindevent()
Message
 
To
14/12/2003 22:53:25
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00859031
Message ID:
00859036
Views:
17
>Does anyone know why the delegate methoed must have the same parameters as the binded event? If a delegate method is used by many different binded events, the delegate method will need to have # of parameters that is at least equal to # of the parameters of the binded event which has the most parameters.
>
>My guess is that VFP 8 is executing the binded event inside the delegate method internally.
>
>Thank you for any help,
>
>Peter

This is by design. I guess the idea is that, if the delegate method is related to some event, it, at least, has to have an access to all bound event parameters.

It does not execute the bound event iternally. It does not make sense to do so. If you take a close look at nFlags parameter of BINDEVENT() function, you will see that it defines if the delegate code runs before or after the event code. If the event code would be executed internally from delegate method, then it would mean that the event code might be fired twice, which is not the case.

If a delegate method is bound to several different events, you always can get the reference to the object and the event that caused the delegate method to fire, with AEVENTS(aArrayOfEvents, 0) function. Then you will know how to treat the parameters received - according to the set of parameters that is related to the coreesponding bound event.
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