It is magic 🙂
I will try to explain:
It starts when a control does .Send(name, …)
The name can be any string, but usually should be something specific e.g. Access_NewRecord so it isn’t confused with Send’s from other controls.
Send is a method that controls inherit from Control
Send does .Controller.Msg(name, …, source: origin)
i.e. it sends the original arguments plus the source (if the arguments don’t already contain a source)
.Controller is automatically set on controls when they are constructed. It is their “parent” Controller.
Only Controller’s (or child classes like PassThruController) can implement methods to “receive Send’s
Controller.Msg checks if the controller has a method with the name given as the first argument to Send.
If it finds a method it calls it
If it does not find a method it calls .Controller.Msg which will go to its parent Controller (the one containing this one)
If it reaches WindowBase without finding a method, then the Send is ignored and 0 (zero) is returned.
Since source is a named argument it is optional whether you receive it or not.
Send can send multiple arguments, as in the case of Record_NewValue which sends field and value. There will also be a source argument. “field” is the name of the field, whereas “source” is an instance of a control.
I hope that helps. There are some additional features like Redir and Recv but this is the normal flow.
Sorry for the slow response, I didn’t get the email notification again – this seems to be a recurring problem with this forum 🙁