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

    function pEnableButtons(obj)
%PENABLEBUTTONS Set correct enable status for buttons
%
%  PENABLEBUTTONS(OBJ) sets the buttons between the two model lists to have
%  the correct enable status.  The corresponding context menu items are
%  also enabled/disabled.

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


if isempty(obj.TradeoffPointer) || strcmp(obj.Enable, 'off')
    en = {'off';'off'};
else
    en = {'off';'off'};
    if ~isempty(obj.hProjectModelList.Items)
        en{1} = 'on';
    end
    if ~isempty(obj.hTradeoffModelList.Items)
        en{2} = 'on';
    end
end
set([obj.hAddButton; obj.hRemoveButton], {'Enable'}, en);
set([obj.hMenuAdd; obj.hMenuRemove], {'Enable'}, en);
if ~isempty(obj.hToolbarAddButton) && ishandle(obj.hToolbarAddButton)
    set([obj.hToolbarAddButton; obj.hToolbarRemoveButton], {'Enable'}, en);
end
if ~isempty(obj.hExternalMenuAdd) && isgraphics(obj.hExternalMenuAdd)
    set([obj.hExternalMenuAdd; obj.hExternalMenuRemove], {'Enable'}, en);
end