Hello ,
The short answer is that you can use the “Is Hovered” node. This returns true when the pointer is over a widget. However, I have also added an image to try and explain a little further how my function works. I hope this answers your question.
Selection break down for my function: