Specifications
5 Application Examples
5-52
The Address Book Resize Function
The address book defines it’s own resize function. To use this resize function,
you must set the Application Options dialog
Resize behavior to
“User-specified”, which in turn sets the figure’s
ResizeFcn property to:
address_book('ResizeFcn',gcbo,[],guidata(gcbo))
Whenever the user resizes the figure, MATLAB calls the ResizeFcn
subfunction in the address book application M-file (
address_book.m)
Behavior of the Resize Function
The resize function allows users to make the figure wider, to accommodate long
names and numbers, but does not allow the figure to be made narrower than
its original width. Also, users cannot change the height. These restrictions do
not limit the usefulness of the GUI and simplify the resize function, which
must maintain the proper proportions between the figure size and the
components in the GUI.
When the user resizes the figure and releases the mouse, the resize function
executes. At that point, the resized figure’s dimensions are saved. The
following sections describe how the resize function handles the various
possibilities.
Changing the Width
If the new width is greater than the original width, set the figure to the new
width.
The size of the
Contact Name text box changes in proportion to the new figure
width. This is accomplished by:
•Changing the
Units of the text box to normalized.
•Resetting the width of the text box to be 78.9% of the figure’s width.
•Returning the
Units to characters.
If the new width is less than the original width, use the original width.
Changing the Height
If the user attempts to change the height, use the original height. However,
because the resize function is triggered when the user releases the mouse
button after changing the size, the resize function cannot always determine the