How could a Button object send ButtonClick() event message to
a Form object? It is not an OOP concept.
The Form object "has a" Button object.
So, a button can not send message to a form object.
The ButtonClick event handler is IDE-managed, it is not OOP.
>
>
>How could a Button object send ButtonClick() event message to
>a Form object? It is not an OOP concept.
>The Form object "has a" Button object.
>So, a button can not send message to a form object.
>
It does not. The form actually sends the message to the "button" that the button has been clicked, then the button acts
upon that information.
>The ButtonClick event handler is IDE-managed, it is not OOP.
Don't confuse OOP with how a program actually functions. They are not always related. But in this case, they are.
Advice: Look into message handling by Windows and VCL. You will begin to see the burdensome reality of OOP.
Stuart B.
It does. The ButtonClick() event handler is called from Button object to Form object.
> It does. The ButtonClick() event handler is called from Button object
> to Form object.
No, the button objects stores a callback object, of a special BCB type
called a __closure. If such an object is stored in its OnClick
property, it asks it to perform its action.
When the form loads, it sets various properties of the Button object it
owns, such as Caption, Top and Left. It may also set a value for the
OnClick property, by making the appropriate callback object.
So the button knows nothing about the form, all it knows is the
callback. The callback is created by the form, and typically points to
a bound member function in itself. That is OK though, as the form has
the info to do this, not the button.
AlisdairM(TeamB)