function hlp_shw(num)

% function hlp_shw(num)
%
% This function is used in conjunction with FD3.  It displays help message
% number 'num' in the help window.  If necessary, it creates a slide bar so
% that the user can view different parts of the help message.  This function
% removes the help message currently being viewed from the 'Help' menu
% since one wouldn't one to select that message.  It also puts the name of
% the current help topic in the window title.
%
% ACP

% Last update:  July 7, 1993
% Author:       Adrian C. Penisson

global FD3HELPFIG FD3HELPAXES FD3HELPMENU FD3HELPSLIDER

h=get(FD3HELPFIG,'CurrentObject');
child=get(FD3HELPMENU,'Children');
set(child,'Visible','on');
set(child(num),'Visible','off');
set(FD3HELPFIG,'Name',['FROG Draw 3: HELP (' get(child(num),'Label') ')'],...
   'Resize','off','NextPlot','new');

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Delete any previous help message %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

delete(get(FD3HELPAXES,'Children'));

%%%%%%%%%%%%%%%%%%%%%
% Load Help Message %
%%%%%%%%%%%%%%%%%%%%%

fid=fopen(['help' int2str(num)],'r');

wflag=1;
while wflag
   record=fgetl(fid);
   if isstr(record)
      message=[message record];
   else
      wflag=0;
   end
end

%%%%%%%%%%%%%%%%%%%%%%
% Write help message %
%%%%%%%%%%%%%%%%%%%%%%

positions=[0 find(message=='|') length(message)+1];
numlines=1+sum(message=='|');

for i=1:numlines
    y=1-(.05*i);
    str=message((positions(i)+1):(positions(i+1)-1));
    text('Position',[.08,y],'String',str,'Horizontal','Left','Vert','Bottom');
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Make scroll bar if necessary %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

set(FD3HELPAXES,'Ylim',[0 1]);

if y<0

   % In this case, a scroll bar is necessary.

   if any(FD3HELPSLIDER)

      % If there is already a scroll bar, just adjust it's numeric values.

      set(FD3HELPSLIDER,'Min',y+1,'Value',1);

   else

      % If there isn't a scroll bar, make one.

      FD3HELPSLIDER=uicontrol('Style','slider','Units','Normalized',...
	 'Position',[0 0 .04 1],'Value',1,'Max',1','Min',y+1,'Call',...
	 'adj_hlp');

%      if get(0,'ScreenDepth')==1
%
%	 % Go through the silliness of inverting the color twice if the
%	 % display is black and white.
%
%	 set(FD3HELPSLIDER,'Foreground',[1 1 1],'Background',[0 0 0])
%	 cinvert(FD3HELPFIG)
%	 drawnow
%	 cinvert(FD3HELPFIG)
%
%      end

   end

elseif any(FD3HELPSLIDER)

   % Delete any unnecssary slider which may be haning around.

   delete(FD3HELPSLIDER)
   FD3HELPSLIDER=[];

end
