Graphics Programs Reference
In-Depth Information
up menus, and so on). (See demo for examples of these.)
2. Use graphical elements that perform a dual function: display data
and interaction. For example, a plotted line can both display data
and can alter data when a user clicks on the line and drags it to a
new position. (See sigdemo1 in the signal processing toolbox for
an example.)
3. Use mouse-downs, drags, and mouse-ups anywhere within the Fig-
ure to perform an action. (For example, typing rotate3d whenever
you are displaying a three-dimensional plot allows you to click and
drag to change the viewpoint.)
The first group of GUIelements (buttons, etc.) are the easiest to work
with, so we deal with those first.
There are three GUI-specific graphical objects in matlab: uicontrols,
uimenus, and uicontextmenus.
These are at the same level as Axes objects in matlab's object hierarchy.
They are children of Figures; they have no children. Their appearance
and behaviour are defined by their property values. We first look at the
different styles of uicontrol. Then we will look at how you can program
a uicontrol to do something by setting its callback property. Finally,
we will go through the various uicontrols in a bit more detail, before
considering uimenus. Uicontextmenus control matlab's behaviour when
you do a “right-click” (or equivalent menu-getting click on your system)
on a graphical object. They will not be described here, but you can find
a description in the helpdesk entry under Handle Graphics Objects.
If you type uicontrol , you will get matlab's default uicontrol (we
assign its handle to h for later use):
h = uicontrol;
As usual, get(h) will give you a list of properties for this object. An
important property for uicontrols is the style property. The style of this
object is
>> get(h,'style')
ans =
Search WWH ::

Custom Search