Another way is to use events only as you can then only do something when you would expect to.
For example, check events to see if a mouse button press happened and then check if the mouse was inside the button. Similar work for mouse button release if you want it to activate on release.
If you also want the ability to hover, then - again with events - check to see if mouse was moved and then check if the mouse is now inside the button. If so, it's now hovering; if not, it's now not.