This repository was archived by the owner on Oct 11, 2022. It is now read-only.
forked from nickelsworth/swag
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path0083.pas
More file actions
101 lines (85 loc) · 2.76 KB
/
Copy path0083.pas
File metadata and controls
101 lines (85 loc) · 2.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
{
ms> Does anybody have a database scroling rutine. When I say a database
ms> scroling rutine I mean that you have som records which is longer than the
ms> screen and then you need to scroll up or down to view the rest of it.
ms> In the rutine you should could scroll up and down.
Here is a copy of a sort of generic viewing routine incorporating most of
the VT100 keyboard commands, including home/end and pgup/pgdn.
}
Procedure PrintScr;
Type
GenFile : String[80];
Var
QuitBrowse : Boolean;
BalString : String[80];
M, Lin, Top : Integer;
Com, Key : Char;
DtaLen : Word;
ViewFile : File of GenFile;
Begin
ClrScr;
QuitBrowse := False;
Top := 0;
Assign(ViewFile,'yourfile.txt');
Reset(ViewFile);
DtaLen := Filesize(ViewFile) -1;
While Not QuitBrowse Do
Begin
For Lin := Top to (Top+24) Do
Begin
Seek(ViewFile,Lin);
Read(ViewFile,LineData);
RetrLine(DtaHandle,Lin);
BalString[0] := #80;
For M := 1 to 80 Do
BalString[M] := LineData[M];
QWrite((Lin-Top)+1,1,CfgData.IFo+CfgData.IBa,BalString);
End;
Com := ReadKey;
Case Com Of
#0:
Begin
Key := ReadKey;
Case Key Of
#73 : { PgUp }
Begin
Top := Top -24;
If Top < 0 Then Top := 0;
End;
#81 : { PgDn }
Begin
Top := Top +24;
If Top > DtaLen Then
Top := DtaLen;
End;
#72 : { Up Arrow }
Begin
Dec(Top);
If Top < 0 Then Top := 0;
End;
#80 : { Dn Arrow }
Begin
Inc(Top);
If Top > DtaLen Then
Top := DtaLen;
End;
#119,#132 : { ^Home / ^PgUp }
Top := 0;
#117,#118 : { ^End / ^PgDn }
Begin
Top := DtaLen -5;
If Top < 0 Then Top := 0;
End;
End; { Case Key }
End; { Case #0 }
#27: { ESC }
QuitBrowse := True;
End; { Case Com }
End;
End; { Procedure PrintScr }
You will, of course, need to modify the parameters and such to fit your own
needs. As a rule, I use this as a pattern for viewing routines, adjusting as
required for the type of material being displayed.
Good luck,
RB