www.gusucode.com > mbclayouts 工具箱 matlab 源码程序 > mbclayouts/@xregcontainer/adddeletecallback.m

    function adddeletecallback(obj, cb)
%ADDDELETECALLBACK Add a callback that is called when the object is destroyed.
%
%  ADDDELETECALLBACK(OBJ, CB) adds a callback that is called when the
%  layout is destroyed.  You should use this method instead of overloading
%  the delete method, which may be called after the core data has already
%  been destroyed.

%  Copyright 2005 The MathWorks, Inc.


if ishandle(obj.g)
    obj.g.addDestructionListener({@i_executecb, cb, obj});
end


function i_executecb(src, evt, cb, obj)
% Change the source fo the event to this object
xregcallback(cb, obj, evt);