www.pudn.com > snake_program.rar > WriteHelp.m


function WriteHelp(str) 
global IntYPos;				% vector of inital position of the every text line - used for slider 
global HDhelpAxes; 
global HDvectorOfTexthd; 
global xsize ysize adgeD; 
global HDhelpSlider1 HDhelpSlider2;	%handle of the slider for help text  
 
if ~isempty(HDvectorOfTexthd) 
	delete(HDvectorOfTexthd);  
   HDvectorOfTexthd=[]; 
end; 
 
Fsize=8; 
xpos=5; 
ypos=ysize-10; 
HD=[]; 
HDtext=[]; 
IntYPos=[]; 
 
set(HDhelpSlider1,'Value',1); 
set(HDhelpSlider2,'Value',0); 
 
j=1; 
for i=1:length(str) 
   if str(i)=='|' 
      labelPos=[xpos ypos]; 
		HDtext = text('Parent', HDhelpAxes, ... 
   		'Units','pixels', ... 
   		'Position',labelPos, ... 
   		'Horiz','left', ... 
   		'String',str(j:i-1), ... 
         'Interruptible','off', ... 
         'Clipping','On',... 
         'FontSize',Fsize,... 
         'Color',[0 0 0]); 
      HD=[HD HDtext]; 
      j=i+1; 
      IntYPos=[IntYPos ypos]; 
      ypos=ypos-15; 
   end 
   if str(i)=='~' 
      ypos=ypos-5; 
      j=i+1; 
   end; 
    
 end; 
 labelPos=[xpos ypos]; 
		HDtext = text('Parent', HDhelpAxes, ... 
   		'Units','pixels', ... 
   		'Position',labelPos, ... 
   		'Horiz','left', ... 
   		'String',str(j:i), ... 
         'Interruptible','off', ... 
         'Clipping','On',...          
         'FontSize',Fsize,... 
         'Color',[0 0 0]); 
 HD=[HD HDtext]; 
 HDvectorOfTexthd=HD; 
 IntYPos=[IntYPos ypos]; 
 col=[1 1 1]; 
  
  
 set(HDhelpAxes,'Units', 'pixels','Position',[adgeD*2+xsize adgeD xsize ysize],... 
   					'Units', 'normal',... 
                  'XLim',[0 1],... 
                  'YLim',[0 1],... 
                  'Color',col,... 
                  'XColor',col,... 
               	'YColor',col,... 
                  'GridLineStyle','none',... 
                  'XTickMode','manual','XTick',[],... 
                  'YTickMode','manual','YTick',[],... 
                  'Units', 'pixels'); 
 
return