source: branches/Pascal Compiler 2/UMainForm.pas

Last change on this file was 16, checked in by george, 15 years ago
  • Přidáno: Další pokusný projekt překladače.
File size: 1.1 KB
Line 
1unit UMainForm;
2
3interface
4
5uses
6 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7 Dialogs, StdCtrls, ComCtrls;
8
9type
10 TForm1 = class(TForm)
11 RichEdit1: TRichEdit;
12 TreeView1: TTreeView;
13 procedure FormShow(Sender: TObject);
14 procedure FormClose(Sender: TObject; var Action: TCloseAction);
15 procedure RichEdit1KeyUp(Sender: TObject; var Key: Word;
16 Shift: TShiftState);
17 private
18 { Private declarations }
19 public
20 SourceCode: TStrings;
21 end;
22
23var
24 Form1: TForm1;
25
26implementation
27
28uses
29 USyntaxHighLight;
30
31{$R *.dfm}
32
33procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
34var
35 StringList: TStringList;
36begin
37 with TStringList.Create do try
38 Assign(RichEdit1.Lines);
39 SaveToFile('Example.pas');
40 finally
41 Free;
42 end;
43end;
44
45procedure TForm1.FormShow(Sender: TObject);
46begin
47 try
48 RichEdit1.Lines.LoadFromFile('Example.pas');
49 ProcessHighlight(RichEdit1);
50 except
51 end;
52end;
53
54procedure TForm1.RichEdit1KeyUp(Sender: TObject; var Key: Word;
55 Shift: TShiftState);
56begin
57 ProcessHighlight(RichEdit1);
58end;
59
60end.
Note: See TracBrowser for help on using the repository browser.