I am creating a custom Panel component that displays a TPanel .
I want my new component to have some code executed on the OnMouseEnter and OnMouseLeave events , however I donβt know how to implement it.
I see that TPanel has published the properties OnMouseEnter , OnMouseLeave .
How to override them and add some of my own codes?
An example of my idea:
The default behavior is TMyPanel , which should be in the component itself.
on event OnMouseEnter do: Color := NewColor; on event OnMouseLeave do: Color := OldColor;
And then, I want to be able to assign some function to these events at runtime. This assignment is performed in the application.
.. TButton1.Click .. begin MyPanel1.OnMouseEnter := DoSomethingMore; MyPanel1.OnMouseLeave := DoSomethingElse; end;
therefore, at the end, when the mouse is over a new panel, it should change color and perform some other actions written in the DoSomethingMore procedure.
thanks
source share