home *** CD-ROM | disk | FTP | other *** search
- unit helpunit;
-
- { This TP Ver 4 unit will allow the user to construct a standard ASCII
- text file of help information which is displayed 23 lines at a time on
- the screen. The procedure HELP is called with any valid DOS filename
- which contains the help information. If the file does not exist an error
- message is displayed asking for operator acknowledgement and the procedure
- issues an exit command.
-
- Navigation on the various help screens is controlled with the PgUp, PgDn,
- Home and End keys. A single line appears at (1,25) describing the keys
- to the user. The Esc key is used to end the help procedure and return to
- the calling procedure.
-
- The constraints on the text file which contains the help information are:
-
- 1. No more than 23 lines.
- (An "error in row length" message will appear at each attempt
- to exceed this limit)
-
- 2. Pages are delimited with a ".pa" (a la WordStar but only lowercase
- accepted )
-
- 3. Only standard ASCII text as created with the Turbo Editor.
-
- }
-
-
-
- interface
- uses crt;
-
- procedure help(filename:string);
-
- implementation
-
-
-
- {-------------------------------------------------------------}
-
- procedure help(filename:string);
-
- type
- help_ptr=^help;
- help=record
- lines:array[1..23] of string[80];
- next,previous:help_ptr;
- end;
-
-
- var
- x:integer;
- help_file:text;
- ans:char;
- data:string[80];
- head,help_data,temp,old:help_ptr;
- heaptop:^integer;
-
- begin
- ans:=' ';
- clrscr;
- gotoxy(1,10);
- writeln(' Reading in help file -- Please standby ');
- textcolor(white);
- assign(help_file,filename);
- {$I-}
- reset(help_file);
- {$I+}
- if ioresult<>0 then
- begin
- textcolor(lightred);
- gotoxy(1,25);clreol;
- write(^G,'ERROR -- The help file does not exist. Push any key to return');
- textcolor(white);
- ans:=readkey;
- exit;
- end;
-
-
- textcolor(yellow);
- textbackground(blue);
- gotoxy(1,25);clreol;
- write('PgUp -next pg PgDn -previous pg Home -first pg End -last pg Esc -Exit');
- textcolor(white);
- textbackground(black);
- window(1,1,80,24);
-
- mark(heaptop);
- new(head);
- new(help_data);
- fillchar(help_data^,sizeof(help_data^),0);
- head^.next:=help_data;
- help_data^.next:=nil;
- help_data^.previous:=nil;
- x:=1;
-
- while (not eof(help_file)) do
- begin
- readln(help_file,data);
- if (data<>'.pa') then
- begin
- help_data^.lines[x]:=data;
- x:=x+1;
- if x>23 then
- begin
- x:=23;
- writeln('Error in row length');
- end;
- end
- else
- begin
- new(temp);
- old:=help_data;
- help_data^.next:=temp;
- help_data:=temp;
- help_data^.next:=nil;
- help_data^.previous:=old;
- fillchar(help_data^.lines,sizeof(help_data^.lines),0);
- x:=1;
- end;
-
- end; {end while not eof and 27}
-
-
-
- {now that we've got all the info, write it out }
- head^.previous:=help_data;
- help_data:=head^.next;
- repeat
- clrscr;
- gotoxy(1,1);
- for x:=1 to 23 do writeln(help_data^.lines[x]);
- ans:=readkey;
- if ans=#0 then
- begin
- ans:=readkey;
- case ans of
- #73:if help_data^.next<>nil then help_data:=help_data^.next else write(^G);
- #81:if help_data^.previous<>nil then help_data:=help_data^.previous else write(^G);
- #71:help_data:=head^.next;
- #79:help_data:=head^.previous;
- end; {end case}
- end; {end if ans=#0}
- until (ans=#27);
-
- close(help_file);
- release(heaptop);
- window(1,1,80,25);
- clrscr;
-
- end;
-
- {-------------------------------------------------------------}
-
-
- end.