www.gusucode.com > mbcexpr 工具箱 matlab 源码程序 > mbcexpr/@cgexprgui/@InputSelector/pEnableButtons.m

    function pEnableButtons(obj)
%PENABLEBUTTONS Set the enable status on the buttons
%
%  PENABLEBUTTONS(OBJ) sets the buttons to be enabled or disabled according
%  to whether an appropriate selection is available in each list.

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


pSel = obj.hSelList.getCurrentExpression;
if isempty(pSel) || isnull(pSel)
    set(obj.hDeselButton, 'Enable', 'off');
else
    set(obj.hDeselButton, 'Enable', 'on');
end

pAvail = obj.hAvailList.SelectedItems;
if isempty(pAvail)
    set(obj.hSelButton, 'Enable', 'off');
else
    set(obj.hSelButton, 'Enable', 'on');
end