Creating Graphical User Interfaces Previous page   Next Page

Resize Behavior

You can control whether users can resize the figure window containing your GUI and how MATLAB handles resizing. GUIDE provides three options:

The first two approaches simply set properties appropriately and require no other action. Other (Use ResizeFcn) requires you to write a callback routine that recalculates sizes and positions of the components based on the new figure size. The following sections discuss each approach.

Making Your GUI Nonresizable

Certain types of GUIs are typically nonresizable. Warning and simple question dialog boxes, particularly modal windows, are usually not resizable. After a simple interaction, users dismiss these GUIs so changing their size is not necessary.

Property Settings.   GUIDE sets the following properties to create nonresizable GUIs:

Allowing Proportional GUI Resizing

Use this approach if you want to allow users to resize the GUI and are satisfied with a behavior that simply scales each component's size and relative position in proportion to the new figure size. Note that the font size of component labels does not resize and, if the size is reduced enough, these labels may become unreadable. This approach works well with simple GUI tools and dialog boxes that apply settings without closing.

Property Settings.   GUIDE sets the following properties to create proportional resizing GUIs:

User-Specified Resize Operation

You can create GUIs that accommodate resizing, while at the same time maintain the appearance and usability of your original design by programming the figure ResizeFcn callback routine. This callback routine allows you to recalculate the size and position of each component based on the new figure size.

This approach to handling figure resizing is used most typically in GUI-based applications that require user interaction on an ongoing basis. Such an application might contain axes for displaying data and various components whose position and size are critical to the successful use of the interface.

Property Settings.   GUIDE sets the following properties to implement this style of GUI:

See The Address Book Resize Function for an example of a user-written resize function.


Previous page  Selecting GUI Options Command-Line Accessibility Next page

© 1994-2005 The MathWorks, Inc.