www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/@mbcmultiview/@ViewList/pRemoveViewInstance.m
function pRemoveViewInstance(obj, ViewID) %PREMOVEVIEWINSTANCE Respond to a view object being deleted % % PREMOVEVIEWINSTANCE(OBJ, VIEWID) decrements the count the number of % views of type VIEWID and removes the listener on the view that has been % deleted. % Copyright 2005-2010 The MathWorks, Inc. and Ford Global Technologies, Inc. Index = (obj.ViewID==ViewID); obj.NumCreated(Index) = obj.NumCreated(Index)-1; % Find listener that is attached to a view that is being destroyed, and % removed this from the list of listeners L = obj.DestructionListeners{Index}; keep = true(size(L)); for n = 1:length(L) if ~ishandle(L(n).SourceObject) || mbcgui.util.isBeingDestroyed(L(n).SourceObject) keep(n) = false; end end L = L(keep); obj.DestructionListeners{Index} = L;