www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/@xregtools/@MBrowser/doDrawMenus.m
function doDrawMenus(h) % DODRAWMENUS update menus on Mbrowser % % doDrawMenus(h) % % Copyright 2000-2010 The MathWorks, Inc. and Ford Global Technologies, Inc. % Created 18/4/2001 % Update the recent file list in the File Menu AP= mbcprefs('mbc'); LastOpened = getpref(AP,'LastOpened'); if isempty(LastOpened) set(h.Hand.Menubar.recentFiles,'Visible','off'); else n=length(LastOpened); for i=n:-1:1 file=fullfile(LastOpened(i).Path,LastOpened(i).File); if length(file)>25 lbls(i)={[sprintf('&%d ',i) file(1:3) '...' file(end-18:end)]}; else lbls(i)={[sprintf('&%d ',i) file]}; end cbs(i)={{@i_openfile,h,file, i}}; end set(h.Hand.Menubar.recentFiles(1:n),'Visible','on',{'Label'},lbls(:),{'Callback'},cbs(:)); set(h.Hand.Menubar.recentFiles(n+1:end),'Visible','off'); end function i_openfile(srcobj,evt,h,file, k) ok=h.OpenProject(file); return