mouseExit, mouseEnter with Custom Component


#1

Hi all,

I am having difficulties with my custom window-like component. What I need to make is when mouse enters the component to paint it with full opacity and when mouse exits it with some alpha value. This works perfectly with component that doesn’t contain other components (like Labels, TextFields etc.). The problem is when I move mouse over a Label inside this component that is located near the edge of the main component and then move mouse out of it. The main component doesn’t send mouseExit() event (which I use for changing opacity of the comp.)…
I understand that the problem is because the mouse is no longer above the main component but the child component instead so it can’t fire the event when user quickly moves mouse out.
I would like to ask if any one knows of some neat solution to this problem?

Thank you in advance.
Y.


#2

Have a look at the Component::addMouseListener method - it has an option to pick up these events.


#3

Excellent, it did exactly what I needed! Thank you!
Y.


#4