www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/@xregGui/@containerData/doDecideHG.m
function doDecideHG(obj, el) %DODECIDEHG Check each element for being HG/not % % DODECIDEHG(OBJ, ELEMENTS) checks each element for whether it is a HG % object or a handle or neither, then saves the result. % Copyright 2000-2013 The MathWorks, Inc. and Ford Global Technologies, Inc. % Disconnect any controls that are beneath us old_el = obj.elements; for n = 1:numel(old_el) if obj.IsHandle(n) && ~isgraphics(old_el{n}) && ishandle(old_el{n}) ... && old_el{n}.up==obj % a different udd handle try old_el{n}.connect(xregfigurehook(old_el{n}.Parent),'up') end elseif isa(old_el{n}, 'xregcontainer') % Disconnect containerdata try cdata = get(old_el{n}, 'containerdata'); if ishandle(cdata) && cdata.up==obj % move back to figure connection cdata.connect(xregfigurehook(cdata.Parent),'up') end end end end if isempty(el) obj.IsHG = false(0); obj.IsHandle = false(0); else tmp = CheckHGLoop(obj,el); obj.IsHG = tmp{1}; obj.IsHandle = tmp{2}; % Loop over handles and connect them if they are layouts or widgets for n = 1:numel(el) if ~obj.IsHG(n) if obj.IsHandle(n) && ~isgraphics(el{n}) el{n}.connect(obj, 'up'); elseif isa(el{n}, 'xregcontainer') % Connect containerdata cdata = get(el{n}, 'containerdata'); cdata.connect(obj, 'up'); end end end end