
12 Examples of GUIs Created Programmatically
12-14
Note If you specify the Units property, then the Position property, and any
other properties that depend on the value of the
Units property, should follow
the Units property specification.
See the Axes Properties reference page for information about axes properties
and their default values.
The Pop-Up Menu
The following statement creates the pop-up menu.
hPlotsPopupmenu = uicontrol(... % List of available types of plot
'Parent', hMainFigure, ...
'Units','normalized',...
'Position',[0.11 0.85 0.45 0.1],...
'HandleVisibility','callback', ...
'String',mPlotTypes(:,1),...
'Style','popupmenu');
• The uicontrol function creates various user interface controls based on the
value of the
Style property. Here the Style property is set to popupmenu.
• For a pop-up menu, the
String property defines the list of items in the menu.
Here it is defined as a 5-by-1 cell array of strings derived from the cell array
mPlotTypes.
See the Uicontrol Properties reference page for information about properties of
uicontrol objects and their default values.
The Update Push Button
This statement creates the Update push button as a uicontrol object.
hUpdateButton = uicontrol(... % Button for updating selected plot
'Parent', hMainFigure, ...
'Units','normalized',...
'HandleVisibility','callback', ...
'Position',[0.6 0.85 0.3 0.1],...
'String','Update',...
'Callback', @hUpdateButtonCallback);
Commenti su questo manuale