www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgtradeoffgui/@modelSetupList/attachMenu.m

    function attachMenu(obj, hMenu)
%ATTACHMENU Create menu items for interacting with the object
%
%  ATTACHMENU(OBJ, HMENU) creates menu items in the given menu handle that
%  provide an alternative means of interacting with the object.  HMENU must
%  be a handle to a uimenu or uicontextmenu object.
%
%  The menus that are created will have their enable status controlled by
%  the modelSetupList, but they will not be deleted when the object is
%  deleted.

%  Copyright 2000-2010 The MathWorks, Inc. and Ford Global Technologies, Inc.


obj.hExternalMenuAdd = uimenu(hMenu, ...
    'Separator', 'on', ...
    'Enable', get(obj.hAddButton, 'Enable'), ...
    'Label', '&Add Model to Display List', ...
    'Callback', {@i_add, obj});
obj.hExternalMenuRemove = uimenu(hMenu, ...
    'Enable', get(obj.hRemoveButton, 'Enable'), ...
    'Label', 'Re&move Model from Display List', ...
    'Callback', {@i_remove, obj});


function i_add(src, evt, obj)
obj.pAdd;

function i_remove(src, evt, obj)
obj.pRemove;