-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLogView_u.pas
69 lines (56 loc) · 1.53 KB
/
LogView_u.pas
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
unit LogView_u;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.StdCtrls;
type
TfrmLog = class(TForm)
mmoLogView: TMemo;
tmrUpdateLog: TTimer;
tmrScroll: TTimer;
procedure tmrUpdateLogTimer(Sender: TObject);
procedure tmrScrollTimer(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormHide(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmLog: TfrmLog;
implementation
{$R *.dfm}
procedure TfrmLog.FormClose(Sender: TObject; var Action: TCloseAction);
begin
tmrScroll.Enabled:= False;
tmrUpdateLog.Enabled:= False;;
end;
procedure TfrmLog.FormHide(Sender: TObject);
begin
tmrScroll.Enabled:= False;
tmrUpdateLog.Enabled:= False;
end;
procedure TfrmLog.FormShow(Sender: TObject);
begin
tmrScroll.Enabled:= True;
tmrUpdateLog.Enabled:= True;
frmLog.SendToBack;
end;
procedure TfrmLog.tmrScrollTimer(Sender: TObject);
begin
begin
//mmoLogView.Perform(WM_VSCROLL, SB_LINEDOWN, 0);
mmoLogView.SelStart := Length(mmoLogView.Text);
mmoLogView.Perform(EM_SCROLLCARET, 0, 0);
end;
end;
procedure TfrmLog.tmrUpdateLogTimer(Sender: TObject);
begin
begin
mmoLogView.Lines.LoadFromFile(GetEnvironmentVariable('appdata') + '/POS 2.0/LOGS/' +
FormatDateTime('dd-mm-yyyy',Now) + '.log');
end;
end;
end.