function [htext,haxes]=textslid(hslid,htext,haxes,textin)
%
%  Name:  textslid 
%
%  Usage:  [htext,haxes]=textslid(hslid,htext,haxes,textin)
%
%
%  Version SWD960708
%
%  Author(s): Scott W. Doebling, doebling@lanl.gov
%	(adapted from Phillip Cornwell, cornwell@lanl.gov)
%
%  Institution: Los Alamos National Laboratory,
%               ESA-EA
%
%  Copyright (c) 1996, The Regents of the University
%       of California. (See top level of code for
%       full copyright statement.)

if ~exist('htext'),htext=[];end;
if ishandle(htext), delete(htext); end;

% Determine the number of rows and columns
[m,n] = size(textin);


% Draw the first column
axis([1 m 1 n]);
drawnow
tmp = text(.5,.5,'t');
ext = get(tmp,'Extent');
dy = ext(4);  % Height
wch = ext(3); % Width of a single character.
fw = 7;       % Column width.  Each column can have up to 
              % 8-digits in it.
wc = 7*wch;   % Width of 8 digit column
dwc = .5*wch;  % Distance between columns
dx = wc+dwc;  % Step used for columns
x = 1;        % Location of first column
delete(tmp)

%
%  the first column (index)
%

axes(haxes)
x=1;
y=1+20*abs(dy);
for j=1:m  %row
   y=y-abs(dy);   %location of row
   t(j)=text(x,y,textin(j,:));
   set(t(j),'color','k','FontSize',10,'HorizontalAlignment','left', ...
	'FontName','courier');
end
htext=t;
% Fix up the axes

miny = 1;
maxy = miny+20*abs(dy);
axis([1 56  miny maxy])

% Add a vertical slider

set(hslid,'min',-m,'userdata',dy);

return
