www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/@xregGui/@RunTimePointer/LinkToObject.m

    function LinkToObject(h,fH)
% LinkToFigure   Link the pointer data to object existence
%
%  h.LinkToObject(fH)
%
%  This method creates a link to the defined object.  If the object is
%  deleted then the pointer's info field is cleared of data.  This is
%  useful for removing unnecessary data from memory if a GUI object is
%  deleted.
%

%  Copyright 2000-2013 The MathWorks, Inc. and Ford Global Technologies, Inc.


if isgraphics(fH,'figure')
    h.connect(xregfigurehook(fH),'up');
    h.L_figstatus = [];
else
    h.L_figstatus = mbcgui.hgclassesutil.listener(fH, 'ObjectBeingDestroyed', ...
        mbcutils.callback(@i_removedata,h));
end


function i_removedata(srcobj,evt,h)
delete(h);