User`s guide
12 Code a Programmatic GUI
Note You can use a button group to m anage exclusive selection behavior for
toggle buttons. See “B utton Group” on page 12-28 for more information.
Program Panels and Button Groups
These topics provide basic code examples for panels and button group
callbacks.
The examples assume that callback properties are specified using function
handles, enabling MATLAB software to pass arguments
hObject,whichisthe
handle of the component for which the event was triggered, and
eventdata.
See “Specify Callbacks in Function Calls” on page 12-11 for more information.
• “Panel” on page 12-28
• “Button Group” on page 12-28
Panel
Panels group GUI components and can make a GUI easier to understand by
visually grouping related controls. A panel can contain panels and button
groups, as well as axes and user interface controls such as push buttons,
sliders, pop-up menus, etc. The position of each component within a panel is
interpreted relative to the lower-left corner of the panel.
Generally, if the GUI is resized, the panel and its components are also
resized. However, you can control the size and position of the panel and its
components. You can do this by setting the GUI
Resize property to on and
providing a
ResizeFcn callback for the panel.
Note See “Cross-Platform Compatible Units” on page 11-96 for information
about the effect of units on resize behavior.
Button Group
Button groups are like panels except that they manage exclusive selection
behavior for radio buttons and toggle buttons. If a button group contains a
12-28