📄 scriptmenu.m
字号:
function scriptmenu(vb, fid)
% Scripts a Menu system from a Visual Basic Menu system
% Martin Dale, July 2002
% Copyright 2002 All Rights Reserved.
% Version 1.00 9 June 2002
% Contact Martin.Dale@Physics.org
menus=fieldnames(vb.menu);
str=['menu_sep=''off'';'];
sep=0;
fprintf(fid,['\n',str,'\n']);
for i=1:length(menus)
fprintf(fid,'\n');
this=eval(['vb.menu.',char(menus(i))]);
info_fields=fieldnames(this);
%create structure with all control information (height width etc) to store in userdata property
for j=1:length(info_fields)
str=['control_info.',info_fields{j},'=''',num2str(eval(['this.',info_fields{j}])),''';'];
fprintf(fid,[str,'\n']);
end
if this.caption=='-'
str=['menu_sep=''on'';'];
fprintf(fid,[str,'\n']);
sep=1;
end
if this.caption~='-'
str=[this.handle,'=uimenu(',this.virtualparent,',''Label'',''',this.caption,''',''separator'',menu_sep,''userdata'',control_info);'];
fprintf(fid,[str,'\n']);
str2=['handlelist.',this.handle,'=',this.handle,';'];
fprintf(fid,[str2,'\n']);
if (sep==1)
str=['menu_sep=''off'';'];
sep=0;
fprintf(fid,[str,'\n']);
end
end
if isfield(this,'tag')
str=['set(',this.handle,',''tag'',''',this.tag,''');'];
fprintf(fid,[str,'\n']);
end
str=['clear control_info;'];
fprintf(fid, [str,'\n']);
end
return;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -