www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgtools/@cgbrowser/doFindFirstType.m
function doFindFirstType(h) %DOFINDFIRSTTYPE Find and select the first type on the tree % % DOFINDFIRSTTYPE(CGB) finds and selects the "initial" type on the current % list. % Copyright 2000-2008 The MathWorks, Inc. and Ford Global Technologies, Inc. if h.GUIExists DefType = findDefault(h); if h.CurrentType==DefType h.doSelectType; else h.CurrentType = DefType; end end function DefType = findDefault(h) if h.GUIExists && ~isnull(h.RootNode) tpI = cgtools.cgtypecollection; TPS = tpI.TypeObjects; FoundProcess = false; for i=1:length(TPS) if isa(TPS(i),'cgcategory.cgprocesstype') && ... ~isempty(getprimarynode(h.RootNode.info,TPS(i))) % look for processes which are being used FoundProcess = true; break end end if FoundProcess DefType = TPS(i); else % view models if there are no processes DefType = cgtypes.cgmodeltype; end else DefType = h.DefType; end