# uimenu

## Purpose

Create menu objects.

## Synopsis

    h = uimenu('PropertyName',PropertyValue,...)
    hsub = uimenu(h,'PropertyName',PropertyValue,...)

## Description

`uimenu` is a menu object creation function that accepts property name/property value pairs as input arguments. These properties are described under "Object Properties." You can also set and query property values after creating the object by using the `set` and `get` functions.

`h` `=` `uimenu('PropertyName',PropertyValue,...)` creates menus that can perform a predefined action. These menus display along the top of the figure on a menu bar. Each menu choice can itself be a menu that displays its submenu when selected. `h` is the handle of the created menu object.

`hsub` `=` `uimenu(h,'PropertyName',PropertyValue,...)` creates a submenu of the parent menu specified by the handle `h`. If you do not specify the handle of an existing menu, the current figure becomes the parent and the menu is a top-level menu.

## Object Properties

This section lists property names along with the type of values each accepts.

`Accelerator`
  Keyboard equivalent.

  A character specifying the keyboard equivalent for the menu item. This allows users to select a particular menu choice by pressing the specified character in conjunction with another key, instead of selecting the menu item with the mouse. The key sequence is platform-specific:
  - For X-Windows and PC based systems, the sequence is Control-`Accelerator`.
  - For Macintosh systems, the sequence is Command-`Accelerator`.
  The window focus must be in the figure window when the key sequence is entered.

`BackGroundColor`
  Object color.

  A three-element RGB vector or one of MATLAB's predefined names, specifying the color used to fill the rectangle defined by the menu. The default color is light gray. See the ``ColorSpec reference page for more information on specifying color.

`ButtonDownFcn`
  Callback string, object selection.

  Any legal MATLAB expression, including the name of an M-file or function. When you select the object, the string is passed to the `eval` function to execute the specified function. Initially the empty matrix.

`CallBack`
  Menu action.

  Any legal MATLAB expression, including the name of an M-file or function. When you click on the menu, the string is passed to the `eval` function to execute the `Callback`.

`Checked`
  Check mark for selected items.

  `on` Check mark appears next to item, indicating it is selected.
  `off` (Default.) Check mark is not displayed.

`Children`
  Children of uimenu.

  A read-only vector containing the handles of all children of the uimenu object. The children objects of uimenus are other uimenus, which function as submenus.

`Clipping`
  Clipping mode.

  `on` (Default.) Any portion of the menu outside the axes rectangle is not displayed.
  `off` The menu is not clipped.

`Enable`
  Menu enable mode.

  `on` (Default.) Menu item label appears dimmed, indicating you cannot select it.
  `off` Menu label does not appear dimmed.

`ForeGroundColor`
  Text color.

  A three-element RGB vector or one of MATLAB's predefined names, specifying the color of the text on the menu. The default text color is black. See the ``ColorSpec reference page for more information on specifying color.

`Interruptible`
  Callback interruptibility.

  `yes` The menu callbacks (`ButtonDownFcn` and `Callback`) are interruptible by other callbacks.
  `no` (Default.) The menu callbacks are not interruptible.

`Label`
  Menu label.

  A string specifying the text label on the menu items.

`Parent`
  Handle of the uimenu's parent object.

  A read-only property that contains the handle of the uimenu's parent object. The parent of a uimenu is the figure in which it is displayed, or the uimenu of which it is a submenu.

`Position`
  Relative menu position.

  Scalar indicating placement on the menu bar or within a menu. Top-level menus are placed from left to right on the menu bar according to the value of their `Position` property, with 1 representing the left-most position. The individual items within a given menu are placed from top to bottom according to the value of their `Position` property, with 1 representing the top-most position.

`Separator`
  Separator line mode.

  `on` A dividing line is drawn above the menu item.
  `off` (Default.) No dividing line is drawn.

`Type`
  Type of graphics object.

  A read-only string; always `'uimenu'` for a uimenu object.

`UserData`
  User-specified data.

  Any matrix you want to associate with the uimenu object. The object does not use this data, but you can retrieve it using the `get` command`.`

`Visible`
  uimenu visibility.

  `on` (Default.) uimenu is visible on the screen.
  `off` uimenu is not visible on the screen.

## Examples

This example creates a menu labeled Workspace whose choices allow users to create a new figure window, save the variables in the workspace, and exit out of MATLAB.

    f = uimenu('Label','Workspace');
    uimenu(f,'Label','Save','Callback','save');
        uimenu(f,'Label','New Figure','Callback','figure');
        uimenu(f,'Label','Save','Callback','save');
        uimenu(f,'Label','Save','Callback','save');
               'Separator','on', 'Accelerator', 'Q');

## See Also

    uicontrol

(c) Copyright 1994 by The MathWorks, Inc.