www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/@xregtable/scrollindex.m

    function [realrow, realcol]=scrollindex(tbl,row,col)
%SCROLLINDEX  Convert scroll region object indices
%
%  [R,C]=SCROLLINDEX(T,R,C) converts the row and col numbers R and C, as
%  taken from the table T's scroll object's userdata, to a "real" row and
%  col index into the table data.  The new values take into account the
%  scrollbar offsets and the zeroindex setting and any fixed rows and
%  columns.

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


fud=get(tbl.frame.handle,'UserData');

vslud=get(tbl.vslider.handle,'UserData');
hslud=get(tbl.hslider.handle,'UserData');
vslval=round(abs(get(tbl.vslider.handle,'Value')));
hslval=round(get(tbl.hslider.handle,'Value'));

voff=vslud.steps(vslval,1);
hoff=hslud.steps(hslval,1);

realrow = row + voff - fud.zeroindex(1);
realcol = col + hoff - fud.zeroindex(2);