User`s guide
Add Code for Components in C allbacks
selects the second item in the list box w ith Tag property listbox1.
Triggering Callback Execution
MATLAB software executes the list box’s C allback callback after the mouse
button is released or after certain key press events:
• The arrow keys change the
Value property, trigger callback executio n, and
set the figure
SelectionType property to normal.
• The Enter key and space bar do not change the
Value property but trigger
callback execution and set the figure
SelectionType property to open.
If the user double-clicks, the callback executes after each click. The software
sets the figure
SelectionType property to normal on the first click and to
open on the second click. The callback can query the figure Sel ectionType
property to determine if it was a single or d ouble click.
List Box Examples
See the following examples for more information on using list boxes:
• “List Box Directory Reader (GUIDE)” on page 10-54 — Shows how to
creates a GUI that displays the contents of directories in a list box and
enables users to open a variety of file types by double-clicking the filename.
• “Access Workspace Variables from a List Box (GUIDE)” on page 10-61
— Shows how to access variables in the MA TLAB base workspace from
alistboxGUI.
Pop-Up Menu
When the pop-up menu Callback callback is triggered, the pop-up menu
Value property contains the index of the selected item, where 1 corresponds to
the first item on the menu. The
String property contains the menu items as
acellarrayofstrings.
Note A pop-up menu is sometimes referred to as a drop-down menu or combo
box.
8-37