I created a class which adds functionality to a figure on construction. This class creates a listener for the WindowMouseMotion
event; however, to get this event to fire I had to add a dummy callback function for the figure's WindowButtonMotionFcn
property. I first check if this property is already populated. If it isn't then I set it to a dummy callback function that does nothing.
Instead of checking if the property is already set or not, can I simply add this dummy callback to any existing callbacks? Is it possible for a callback property to call multiple functions?
EDIT
When using the handle.listener
approach to handle the WindowButtonMotionEvent
event given below, be sure to use eventdata.CurrentPoint
to access the current mouse position. The CurrentPoint
property of the figure does not get updated before handling the WindowButtonMotionEvent
event in this manner.