MATLAB Creating Graphical User Interfaces

(Barry) #1

10 Lay Out a Programmatic UI


This code associates the context menu with the figure and with the axes by setting the
UIContextMenu property of the figure and the axes to the handle cmenu of the context
menu.

fh.UIContextMenu = cmenu; % Figure
ah.UIContextMenu = cmenu; % Axes

Right-click on the figure or on the axes. The context menu appears with its upper-left
corner at the location you clicked. Right-click on the panel or its push button. The context
menu does not appear.
Free download pdf