www.gusucode.com > mbc 工具箱 matlab 源码程序 > mbc/@mctree/listview.m
function h=listview(T,pos,fH,callbacks,TreeCtrl,h) %LISTVIEW Listview activeX control for children of tree. % % h= LISTVIEW(T,pos,fH,callbacks,TreeCtrl,h) % % where: % pos - a length 4 vector specifying position in pixels % fH - figure handle % callbacks - a cell array of strings specifying the event handling % % Copyright 2000-2011 The MathWorks, Inc. and Ford Global Technologies, Inc. if nargin>3 % Create an instance of the Control h = mbcwidgets.List('Parent',fH,... 'UserData', 'modelbrowserList', ... 'Position',pos,... 'Grid',true,... callbacks{:},... 'IconTransparentColor',[255 0 255],... 'IconLocation',xregrespath,... 'SelectionMode','MultiRow'); else h = pos; end ch= children(T); if ~isempty(ch) % statistics [s,ColHead]= childstats(T); sok= ~all(~isfinite(s),1); if ~all(sok) % knock out columns where everything is nonfinite ColHead= ColHead(sok); s= s(:,sok); end w = zeros(1,length(ColHead)); for i= 1:length(ColHead) % add column headers % guess column width based on size of header IsUpper= upper(ColHead{i})==ColHead{i}; w(i)= 10*sum(IsUpper)+6*sum(~IsUpper); end w= max(w,70); h.Peer.setColumnData([{'Name'} ColHead]); h.Peer.setColumnWidths([144 w]); Icons = children(T,@iconfile)'; Data = [ children(T,@name)' num2cell(s) ]; h.Peer.setData(Data,Icons); else h.Peer.setColumnData({'Name'}); h.Peer.setColumnWidths(144); h.Peer.setData({}); end