Add function handle to callback list
Create a figure and register two callback functions. Whenever
MATLAB® detects mouse motion over the figure, function handles
f1
and f2
are called
in the order in which they were added to the list.
figobj = figure; f1 = @(varargin) disp('Callback 1'); f2 = @(varargin) disp('Callback 2'); iptaddcallback(figobj,'WindowButtonMotionFcn',f1); iptaddcallback(figobj,'WindowButtonMotionFcn',f2);
Callback functions that have already been added to an object
using the set
command continue to work
after you call iptaddcallback
. The first
time you call iptaddcallback
for a given
object and callback, the function checks to see if a
different callback function is already installed. If a
callback is already installed, then
iptaddcallback
replaces that
callback function with the iptaddcallback
callback processor, and then adds the preexisting callback
function to the iptaddcallback
list.