www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/@mbcmultiview/@ActionGroup/setMenuProperties.m

    function setMenuProperties(obj, hMenu)
%SETMENUPROPERTIES Set menu item properties to match the action
%
%  SETMENUPROPERTIES(OBJ, HMENU) is called when the menu item's properties
%  need to be set up to match the action's state.

%  Copyright 2005 The MathWorks, Inc. and Ford Global Technologies, Inc.


hP = get(hMenu, 'Parent');
if ~isempty(hP)
    hCh = get(hP, 'Children');
    hCh = findobj( hCh, 'flat', 'Type', 'uimenu' );
    hCh(hCh==hMenu) = [];
    OtherLabels = get(hCh, {'Label'});
    lbl = obj.pUniqueMnemonic(obj.Label, OtherLabels);
else
    lbl = obj.Label;
end

set(hMenu, ...
    'Enable', mbconoff(~isempty(obj.Actions) && obj.Enabled), ...
    'Visible', mbconoff(obj.Visible), ...
    'Checked', 'off', ...
    'Label', lbl);