MATLAB Release Notes |
Creating Graphical User Interfaces (GUIDE) Features
If you are using the Help browser, view the Creating Graphical User Interfaces new features video demo to see highlights of the major new features.
MATLAB 7.0 adds the following new features and enhancements for creating graphical user interfaces.
New Container Components
MATLAB 7.0 introduces two new container components,
These components are available in the GUIDE Layout Editor and via the functions uipanel
and uibuttongroup
.
A container component can be the child of a figure or another container. In general, containers can have as children the same components as figures, including other containers. However, they cannot have menu bars, toolbars, or ActiveX controls as children. The Position
property of the child of a panel or button group is interpreted relative to the panel or button group. If you move the panel or button group, the components it contains automatically move with it and maintain their positions.
Panel properties and button group properties enable you to control the color, size, border, and position of the panel or button group, assign a title, and specify a context menu. In general, panels and button groups have many of the same properties as uicontrol
objects.
Working with Container Components in GUIDE
For information about working with panels and button groups in GUIDE, see the following topics in the Creating Graphical User Interfaces collection of the MATLAB documentation.
ActiveX Controls
GUIDE now enables you to insert an ActiveX control into your GUI if you are running MATLAB on Microsoft Windows. When you drag an ActiveX component from the component palette into the layout area, GUIDE displays a dialog in which you can select any registered ActiveX control on your system. When you select an ActiveX control and click Create, the control appears as a small box in the Layout Editor. You can then program the control to do what you want it to.
See MATLAB COM Client Support in the online MATLAB documentation and ActiveX Controls in the GUIDE documentation to learn more about ActiveX controls.
New Toolbar Component
A new function, uitoolbar
, enables you to add a toolbar to a figure. You can add your own pushtools and toggletools to the toolbar with the uipushtool
and uitoggletool
functions.
Uipushtool properties enable you to provide a callback that responds to a mouse click. Uitoggletool properties enable you to provide callbacks that respond to the tool being set on
, off
, or toggled to either position. Properties for both uipushtools and uitoggletools provide for tooltip strings, separators, and truecolor images to display on the tools. In general, uitoolbar
, uipushtool
, and uitoggletool
objects have many of the same properties as uicontrol
objects.
Menu Editor Enhancements
The GUIDE Menu Editor now enables you to:
Enabled
property on
or off
when the menu is first opened. If the property value is off
, the item appears dimmed and the user cannot select it.
uimenu
properties.
The Menu Editor is now better synchronized with other GUIDE tools:
uimenu
objects in the Menu Editor now also appear in the Object Browser. If you select a uimenu
object in either, it is automatically selected in the other.
See Menu Editor in the MATLAB documentation for more information.
Layout Resize Behavior
In the GUIDE Layout Editor, components you have placed in the layout area now maintain their visual position relative to the upper left corner of their parent container (figure, panel, or button group) when you resize the container. However, the values of the Position
property are determined relative to the lower left corner, and these values will change accordingly when you increase or decrease the height of the container.
Key Press Detection
A new uicontrol
callback property, KeyPressFcn
, specifies a key press callback function with which you can detect a key press when the callback's uicontrol
object has focus. If no uicontrol has focus, the figure's key press callback function, if any, is invoked. This property is available in the uicontrol
function and in GUIDE.
If you specify KeyPressFcn
as an M-file, the callback routine can query the figure's CurrentCharacter
property to determine what particular key was pressed and thereby limit the callback execution to specific keys. If you specify KeyPressFcn
as a function handle, the callback routine can retrieve information about the key that was pressed from its event data structure argument.
As an example, you can use this property to enable a user to press Enter, rather than the space bar, after giving focus to a uicontrol
push button. Use the push button's key press callback function to determine if the user pressed the Enter key. If it was the Enter key, call the push button callback.
See the Uicontrol Properties for more information.
Edit Text Box Scroll Bar
For uicontrol editable text fields, i.e. the Style
property is set to 'edit'
, if Max-Min>1
, then multiple lines are allowed. For multi-line edit boxes, a vertical scroll bar enables you to scroll the text. You can also use the arrow keys to scroll.
Setting Uicontrol Focus
The uicontrol
function now enables you to transfer focus programmatically to a specified uicontrol
object. The syntax uicontrol(uich)
transfers focus to the uicontrol
object with handle uich
.
Multiple Selection in uigetfile
The uigetfile
function can now create a dialog that enables the user to select and retrieve multiple files using the Shift and Ctrl keys. You can turn this capability on or off using the new 'MultiSelect'
parameter. The default setting is off
.
Program Suspension Time-Out
A new uiwait
argument, timeout
, enables you to specify the number of seconds after which program execution will resume, unless uiresume
is called first or the specified figure is deleted. For example,
causes the suspended program to resume execution, if it has not already, after five seconds.
Standard Dialog Box Push Buttons
For standard dialog boxes with more than one uicontrol
push button, you can now give focus to another button while retaining the default button. Focus is denoted by a border or a dotted border, respectively, in UNIX and Microsoft Windows. The default button has a shadow.
In such a case, if the user presses the space bar, the button with focus gets the key press and can choose to execute its own callback or the callback of the default button. If the user presses Enter, the default push button gets the key press and its callback executes. This code provides an example.
ButtonName=questdlg('What is your wish?', ... 'Genie Question', ... 'Food','Clothing','Money','Money')
External Interfaces/API Features | Platform Limitations |
© 1994-2005 The MathWorks, Inc.