www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/@mbcwidgets/@scrollTable/checkScrollLocation.m

    function ret = checkScrollLocation( obj )
%CHECKSCROLLLOCATION  Adjust current row and column if necessary
%
%  FLAG = CHECKSCROLLLOCATION(OBJ) checks that the settings of CurrentRow and
%  CurrentColumn are not too large.  This is useful for situations where
%  the number of visible rows/columns has increased  because that may lead
%  to the table being scrolled beyond it's normal limit.
%
%  The return variable FLAG is a uint8 value indicating whether an
%  adjustment was necessary.  If it is 0 then no adjustments were made.  if
%  the first bit is set to 1 then the CurrentRow property has been altered.
%  If the second bit is set to 1 then the CurrentColumn property has been
%  altered.

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


ret = uint8(0);
dataSize = obj.pGetDataSize;
if (obj.CurrentRow+obj.numRows-1)>dataSize(1)
    obj.CurrentRow = dataSize(1)-obj.numRows+1;
    ret = bitset(ret,1);
end

if (obj.CurrentColumn+obj.numCols-1)>dataSize(2)
    obj.CurrentColumn = dataSize(2)-obj.numCols+1;
    ret = bitset(ret,2);
end