www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/@mbcmultiview/@ToggleAction/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(hCh==hMenu) = [];
    OtherLabels = get(hCh, {'Label'});
    lbl = obj.pUniqueMnemonic(obj.Label, OtherLabels);
else
    lbl = obj.Label;
end

set(hMenu, ...
    'Enable', mbconoff(obj.Enabled), ...
    'Visible', mbconoff(obj.Visible), ...
    'Checked', mbconoff(obj.Selected), ...
    'Label', lbl);