编辑: sunny爹 | 2019-07-04 |
label'
,'
box off'
,'
callback'
,'
box off'
);
h_sub5=uimenu(h_menu,'
label'
,'
Figure Color'
,'
Separator'
,'
on'
);
% h_subsub1=uimenu(h_sub5,'
label'
,'
Red'
,'
ForeGroundColor'
,'
r'
,... % '
callback'
,'
set(gcf,'
'
Color'
'
,'
'
r'
'
)'
);
h_subsub2=uimenu(h_sub5,'
label'
,'
Reset'
,... '
callback'
,'
set(gcf,'
'
Color'
'
,'
'
w'
'
)'
);
PDF created with pdfFactory Pro trial version www.pdffactory.com
8 图11.3.3.3-1 (2)位置属性的获取 Pos_O=get(h_menu,'
position'
), %查询 Option 菜单位置值 Pos_BoxOn=get(h_sub3,'
position'
) %查询 box ob 子菜单位置值 Pos_Red=get(h_subsub1,'
position'
) %查询 red 子菜单的位置值 Pos_O =
3 Pos_BoxOn =
3 Pos_Red =
1 【*例11.3.3.3-2】本例演示:当某菜单项选中后,如何使该菜单项贴上检录符 √ . [exm11333_2.m] figure h_menu=uimenu('
label'
,'
Option'
);
h_sub1=uimenu(h_menu,'
label'
,'
Grid on'
,... % '
callback'
,[... '
grid on,'
,... '
set(h_sub1,'
'
checked'
'
,'
'
on'
'
set(h_sub2,'
'
checked'
'
,'
'
off'
]);
h_sub2=uimenu(h_menu,'
label'
,'
Grid off'
,... % '
callback'
,[... '
grid off,'
,... '
set(h_sub2,'
'
checked'
'
,'
'
on'
'
set(h_sub1,'
'
checked'
'
,'
'
off'
]);
图11.3.3.3-2 Grid on 菜单选中后出现检录符 PDF created with pdfFactory Pro trial version www.pdffactory.com
9 11.3.3.4 使能(Enable)与可见性(Visible)属性 【*例11.3.3.4-1】 本例目标:制作一个带四个子菜单项的顶层菜单项;
该下拉菜单分为两 个功能区;
每个功能区的两个菜单项是相互对立的,因此采用使能属性处理;
当图形窗坐 标轴消隐时,整个坐标分隔控制功能区不可见. (1)编写如下脚本 M 文件 exm11334_1.m [exm11334_1.m] clf h_menu=uimenu('
label'
,'
Option'
);
%产生顶层菜单项Option h_sub1=uimenu(h_menu,'
label'
,'
Axis on'
);
%产生Axis on菜单项,由缺省设置而使能 h_sub2=uimenu(h_menu,'
label'
,'
Axis off'
,... '
enable'
,'
off'
);
%产生Axis off菜单项,但失能 h_sub3........