www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/@xregtools/@MBrowser/CreateMenu.m

    function hmn=CreateMenu(h,GUID,Nmenus)
%CREATEMENU  Request a new top level menu from browser
%
%  H_MENU=mbh.CreateMenu(GUID)  creates a new top level menu and registers it
%  as belonging to GUID.  The new menu handle is returned.
%  H_MENUS=mbh.CreateMenu(GUID,N)  creates N new menus.
%

%  Copyright 2000-2013 The MathWorks, Inc. and Ford Global Technologies, Inc.

idx=find( strcmp( GUID,h.ViewGUIDs ) );

if isempty(idx)
   error(message('mbc:xregtools:MBrowser:InvalidArgument'));
end

if nargin<3
   Nmenus=1;
end


hmn=gobjects(0);
for n=1:Nmenus
   hmn=[hmn;uimenu('Parent',h.Figure,...
         'Visible','off')];
end

mns=h.ViewMenus;
mns{idx}=[mns{idx} ; hmn];
h.ViewMenus=mns;