|
Hi All,
I've got a question about listeners. I'm trying to create an Image/Data Object. What I would like to implement is a listener when the object has changed (to call a separate function for updating) and a listener for deletion (to remove all dependencies outside the Object).
I have been looking for a simple tutorial but most of what I found was beyond my needs.
I would come up with something like this, but unfortunately it is not complete/won't work:
===================================================
classdef ImageObject < handle
properties
Data = [];
Axis = [];
end;
events
Delete
Changed
end;
methods
function obj = ImageObject(varargin)
% some preparation/initialisation code
addlistener(obj,'Delete', @ImageObject.DeleteHandler);
addlistener(obj,'Changed',@ImageObject.ChangedHandler);
end;
function DeleteHandler(obj, eventData)
% some code
end;
function ChangedHandler(obj, eventData)
% some code
end;
end;
end;
===================================================
What do I have to modify to have my listeners (besides of telling better stories ;-)
Many thanks in advance!
Kees
|