www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/+mbcgui/+widget/@ClassicTable/doTRComp.m

    function doTRComp(obj)
%DOTRCOMP Place component in top-right corner
%
%  DOTRCOMP(OBJ)

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

els = get(obj.gridObject, 'elements');
VIS = false;

if ~isempty(els) && ...
        obj.ShowColumnHeaders && ...
        obj.ScrollBarStyle==1 && ...
        (diff(obj.ScrollRowLimits)>0)
    
    if strcmp(obj.ColumnHeaderPosition, 'top')
        els{1, end} = obj.TopRightCorner;
    else
        rs = get(obj.gridObject, 'rowsizes');
        if rs(end-1)>0
            els{end-1, end} = obj.TopRightCorner;
        else
            els{end, end} = obj.TopRightCorner;
        end
    end
    VIS = true;
end

if VIS
    set(obj.gridObject, 'elements', els);
    set(obj.TopRightCorner, 'Visible', obj.Visible);
else
    set(obj.TopRightCorner, 'Visible', 'off');
end

end