Delphi & Pascal (česká wiki)
Přejít na: navigace, hledání
{ HELP.PAS                  Copyright (c) TrSek alias Zdeno Sekerak }
{ Rutiny pre zobrazenie napovedy (help) programu.                   }
{                                                                   }
{ Datum:19.06.1995                            http://www.trsek.com  }
 
procedure help(strana:integer);
var f:text;
 s1,s:string;
    i:integer;
   ch:char;
 
begin
 assign(f,shelp);
 {$I-}
 reset(f);
 {$I+}
 i:=ioresult;
 s:='';
 okno(3,3,76,22,' Help programu ŚALéZIE ',' PgUp-Dopredu PgDn-Dozadu ESC-Koniec     Software by TRSEK ',pnhelp);
 
 repeat
  if i=0 then begin
     close(f);reset(f);
     s:=stri(strana,3);
     while not( eof(f) or (copy(s,2,3)=stri(strana,3) )) do begin
      readln(f,s);s1:=copy(s,2,3);
      end;
     end;
 
  if (i<>0) or eof(f) then begin
     hlaska('Nenaçiel som danŁ kapitolu v HELP sŁbore',40);
     strana:=strana-1;
     if i<>0 then exit;
     end;
 
  farba(pnhelp,fnhelp);s:='  ';
  clrscr;writeln('Strana ',strana);
 
  repeat
   for i:=1 to length(s) do begin
       if s[i]='^' then begin
                        farba(pvhelp,fvhelp); i:=i+1;end
                   else farba(pnhelp,fnhelp);
       write(s[i]);
      end;
   farba(pnhelp,fnhelp);
   writeln;write('  ');
   readln(f,s);
  until ( eof(f) or (s[1]='@') );
 
  ch:=readkey;
  if ch=#0 then begin
     ch:=readkey;
     if ch=#73 then strana:=strana-1;
     if ch=#81 then strana:=strana+1;
     if strana<0 then strana:=0;
     ch:=#0;i:=0;
     end;
 until (ch in [#13,#32,#27]);
 close(f);
end;