Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Update and Delete listeners
Replies: 3   Last Post: Jul 1, 2013 5:47 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
kees de kapper

Posts: 71
Registered: 12/7/04
Update and Delete listeners
Posted: Jun 26, 2013 9:07 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.