1 |
(* ***** BEGIN LICENSE BLOCK *****
|
2 |
* Version: MPL 1.1
|
3 |
*
|
4 |
* The contents of this file are subject to the Mozilla Public License Version
|
5 |
* 1.1 (the "License"); you may not use this file except in compliance with
|
6 |
* the License. You may obtain a copy of the License at
|
7 |
* http://www.mozilla.org/MPL/
|
8 |
*
|
9 |
* Software distributed under the License is distributed on an "AS IS" basis,
|
10 |
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
11 |
* for the specific language governing rights and limitations under the
|
12 |
* License.
|
13 |
*
|
14 |
* The Original Code is TurboPower SysTools
|
15 |
*
|
16 |
* The Initial Developer of the Original Code is
|
17 |
* TurboPower Software
|
18 |
*
|
19 |
* Portions created by the Initial Developer are Copyright (C) 1996-2002
|
20 |
* the Initial Developer. All Rights Reserved.
|
21 |
*
|
22 |
* Contributor(s):
|
23 |
*
|
24 |
* ***** END LICENSE BLOCK ***** *)
|
25 |
|
26 |
unit ExGLog1;
|
27 |
|
28 |
interface
|
29 |
|
30 |
uses
|
31 |
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
32 |
StdCtrls, ExtCtrls, StBase, StGenLog;
|
33 |
|
34 |
const
|
35 |
AppleEvent = 1;
|
36 |
OrangeEvent = 2;
|
37 |
LemonEvent = 3;
|
38 |
GrapeEvent = 4;
|
39 |
UnknownEvent = 5;
|
40 |
|
41 |
type
|
42 |
TForm1 = class(TForm)
|
43 |
RadioGroup1: TRadioGroup;
|
44 |
Button1: TButton;
|
45 |
Button2: TButton;
|
46 |
Edit1: TEdit;
|
47 |
Label1: TLabel;
|
48 |
Button3: TButton;
|
49 |
CheckBox1: TCheckBox;
|
50 |
StGeneralLog1: TStGeneralLog;
|
51 |
procedure CheckBox1Click(Sender: TObject);
|
52 |
procedure Button3Click(Sender: TObject);
|
53 |
procedure Button2Click(Sender: TObject);
|
54 |
procedure Button1Click(Sender: TObject);
|
55 |
procedure StGeneralLog1GetLogString(Sender: TObject; const D1, D2, D3,
|
56 |
D4: Integer; var LogString: String);
|
57 |
procedure FormCreate(Sender: TObject);
|
58 |
private
|
59 |
{ Private declarations }
|
60 |
public
|
61 |
{ Public declarations }
|
62 |
end;
|
63 |
|
64 |
var
|
65 |
Form1: TForm1;
|
66 |
|
67 |
implementation
|
68 |
|
69 |
{$R *.DFM}
|
70 |
|
71 |
procedure TForm1.CheckBox1Click(Sender: TObject);
|
72 |
begin
|
73 |
if CheckBox1.Checked then
|
74 |
StGeneralLog1.WriteMode := wmAppend
|
75 |
else
|
76 |
StGeneralLog1.WriteMode := wmOverwrite;
|
77 |
end;
|
78 |
|
79 |
procedure TForm1.Button3Click(Sender: TObject);
|
80 |
begin
|
81 |
StGeneralLog1.DumpLog;
|
82 |
end;
|
83 |
|
84 |
procedure TForm1.Button2Click(Sender: TObject);
|
85 |
begin
|
86 |
StGeneralLog1.WriteLogString(Edit1.Text);
|
87 |
end;
|
88 |
|
89 |
procedure TForm1.Button1Click(Sender: TObject);
|
90 |
begin
|
91 |
case RadioGroup1.ItemIndex of
|
92 |
0 : StGeneralLog1.AddLogEntry(AppleEvent, 0, 0, 0);
|
93 |
1 : StGeneralLog1.AddLogEntry(OrangeEvent, 0, 0, 0);
|
94 |
2 : StGeneralLog1.AddLogEntry(LemonEvent, 0, 0, 0);
|
95 |
3 : StGeneralLog1.AddLogEntry(GrapeEvent, 0, 0, 0);
|
96 |
else
|
97 |
StGeneralLog1.AddLogEntry(UnknownEvent, 0, 0, 0);
|
98 |
end;
|
99 |
end;
|
100 |
|
101 |
procedure TForm1.StGeneralLog1GetLogString(Sender: TObject; const D1, D2,
|
102 |
D3, D4: Integer; var LogString: String);
|
103 |
begin
|
104 |
case D1 of
|
105 |
AppleEvent : LogString := 'AppleEvent';
|
106 |
OrangeEvent : LogString := 'OrangeEvent';
|
107 |
LemonEvent : LogString := 'LemonEvent';
|
108 |
GrapeEvent : LogString := 'GrapeEvent';
|
109 |
else
|
110 |
LogString := 'UnknownEvent';
|
111 |
end
|
112 |
end;
|
113 |
|
114 |
procedure TForm1.FormCreate(Sender: TObject);
|
115 |
begin
|
116 |
StGeneralLog1.FileName := ExtractFilePath(Application.ExeName) + 'exgenlog.log';
|
117 |
end;
|
118 |
|
119 |
end.
|