Last change
on this file was 42, checked in by chronos, 15 months ago |
- Modified: Improved simple virtual machine.
|
File size:
1.2 KB
|
Line | |
---|
1 | unit FormMessages;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses
|
---|
6 | Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ComCtrls, Message;
|
---|
7 |
|
---|
8 | type
|
---|
9 | TSelectEvent = procedure (Position: TPoint) of object;
|
---|
10 |
|
---|
11 | { TFormMessages }
|
---|
12 |
|
---|
13 | TFormMessages = class(TForm)
|
---|
14 | ListView1: TListView;
|
---|
15 | procedure ListView1Data(Sender: TObject; Item: TListItem);
|
---|
16 | procedure ListView1DblClick(Sender: TObject);
|
---|
17 | private
|
---|
18 | FOnSelect: TSelectEvent;
|
---|
19 | public
|
---|
20 | Messages: TMessages;
|
---|
21 | procedure Reload;
|
---|
22 | property OnSelect: TSelectEvent read FOnSelect write FOnSelect;
|
---|
23 | end;
|
---|
24 |
|
---|
25 |
|
---|
26 | implementation
|
---|
27 |
|
---|
28 | {$R *.lfm}
|
---|
29 |
|
---|
30 | { TFormMessages }
|
---|
31 |
|
---|
32 | procedure TFormMessages.ListView1Data(Sender: TObject; Item: TListItem);
|
---|
33 | begin
|
---|
34 | with Messages do
|
---|
35 | if (Item.Index >= 0) and (Item.Index < Count) then
|
---|
36 | with TMessage(Items[Item.Index]) do begin
|
---|
37 | Item.Caption := IntToStr(Position.X) + ', ' + IntToStr(Position.Y);
|
---|
38 | Item.Data := Items[Item.Index];
|
---|
39 | Item.SubItems.Add(Text);
|
---|
40 | end;
|
---|
41 | end;
|
---|
42 |
|
---|
43 | procedure TFormMessages.ListView1DblClick(Sender: TObject);
|
---|
44 | begin
|
---|
45 | if Assigned(ListView1.Selected) then begin
|
---|
46 | if Assigned(FOnSelect) then
|
---|
47 | FOnSelect(TMessage(ListView1.Selected.Data).Position);
|
---|
48 | end;
|
---|
49 | end;
|
---|
50 |
|
---|
51 | procedure TFormMessages.Reload;
|
---|
52 | begin
|
---|
53 | ListView1.Items.Count := Messages.Count;
|
---|
54 | ListView1.Refresh;
|
---|
55 | end;
|
---|
56 |
|
---|
57 | end.
|
---|
58 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.