Graphics Programs Reference
In-Depth Information
uimenu(f,'Label','Black',...
'Callback','set(gcf,''color'',''k'')');
uimenu(f,'Label','White',...
'Callback','set(gcf,''color'',''w'')');
uimenu(f,'Label','Gray',...
'Callback','set(gcf,''color'',[.5 .5 .5])');
g = uimenu(f,'Label','Other...','Separator','on');
uimenu(g,'Label','Parchment',...
'Callback','set(gcf,''color'',[.95 .9 .8])');
uimenu(g,'Label','Vellum',...
'Callback','set(gcf,''color'',[.9 .9 .8])');
uimenu(g,'Label','Cream',...
'Callback','set(gcf,''color'',[.95 .9 .75])');
The uimenu item that sets the Figure
colour to the default has its “accelera-
tor” property set to “D”, meaning that
when control-D is pressed while the cur-
sor is in the Figure window, the callback
will be executed; in this case the Figure
will go to its default colour. The “Other
... ” menu item has its “separator” set
to “on”, which draws the line above its
label. A clear figure ( clf ) command
will clear user-created uimenus like this
one. The command colormenu is worth looking at as another example
of a simple uimenu.
Exercise 19 Generate the following menu:
(Answer on page 192.)
Search WWH ::




Custom Search