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

    function connectdata(obj, data)
%CONNECTDATA Connect data to the layout object
%
%  CONNECTDATA(OBJ, DATA) connects the UDD object DATA to the UDD core data
%  of the layout OBJ.  This ensures that the object will be destroyed when
%  the layout is deleted.

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


if ishandle(obj.g)
    for n = 1:length(data)
        h = data(n);
        if ~isgraphics(h) && ishandle(h)
            % Connect data directly to g
            h.connect(obj.g, 'up');
        else
            % For HG and MCOS objects, connect a listener to g that destroys the data
            obj.g.connectData(h);
        end
    end
end