www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgtools/@cgbrowser/gotonode.m
function gotonode(h,nodep,SIp,force) %GOTONODE Select a new node in browser % % GOTONODE(CGB, nd, subitem) selects the new node nd and also ensures the % browser is in the correct "section". nd is a node pointer and subitem % is an optional pointer to a browser subitem. % Copyright 2000-2011 The MathWorks, Inc. and Ford Global Technologies, Inc. if h.GUIExists if nargin<3 SIp = nodep.getprimarysubitem; end if nargin<4 force = false; end % Get type from the first major item node upwards in the tree pTypeNode = nodep; while ~pTypeNode.ismajoritem pTypeNode = pTypeNode.Parent; end NewTP = pTypeNode.typeobject; % Check for types that don't exist in the category list, eg normalisers if NewTP.isa('cgtools.cgnormtype') NewTP = cgtypes.cgtabletype; elseif NewTP.isa('cgtools.cgoptimouttype') NewTP = cgtypes.cgoptimtype; end NowTP = h.CurrentType; if ~strcmp(class(NowTP),class(NewTP)) || force h.doSelectType(NewTP, nodep, SIp); else % Refresh the list and treeview to make sure the node is on it h.doDrawTree(nodep,'select'); h.doDrawList; if h.CurrentNode~=nodep || h.CurrentSubItem~=SIp % Move to new node. h.setnewnode(nodep,SIp); else % If node/item are currently being viewed then refresh the display h.ShowNode; h.ViewNode; end end end