Creating Graphical User Interfaces Previous page   Next Page

Pop-Up Menus

You can program the pop-up menu callback to work by checking only the index of the item selected (contained in the Value property) or you can obtain the actual string contained in the selected item.

This callback checks the index of the selected item and uses a switch statement to take action based on the value. If the contents of the pop-up menu is fixed, then you can use this approach.

This callback obtains the actual string selected in the pop-up menu. It uses the value to index into the list of strings. This approach may be useful if your program dynamically loads the contents of the pop-up menu based on user action and you need to obtain the selected string. Note that it is necessary to convert the value returned by the String property from a cell array to a string.


Previous page  List Boxes Panels Next page

© 1994-2005 The MathWorks, Inc.