source: branches/CpuSingleSize/Forms/FormMessages.pas

Last change on this file was 238, checked in by chronos, 16 months ago
  • Modified: Removed U prefix from unit names.
  • Fixed: Memory leaks.
File size: 1.3 KB
Line 
1unit FormMessages;
2
3interface
4
5uses
6 Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ComCtrls;
7
8type
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 procedure Reload;
21 property OnSelect: TSelectEvent read FOnSelect write FOnSelect;
22 end;
23
24
25implementation
26
27{$R *.lfm}
28
29uses
30 Core, Message, FormAssembler;
31
32{ TFormMessages }
33
34procedure TFormMessages.ListView1Data(Sender: TObject; Item: TListItem);
35begin
36 with Core.Core.Assembler do
37 if (Item.Index >= 0) and (Item.Index < Message.Count) then
38 with TMessage(Message[Item.Index]) do begin
39 Item.Caption := IntToStr(Position.X) + ', ' + IntToStr(Position.Y);
40 Item.Data := Message[Item.Index];
41 Item.SubItems.Add(Text);
42 end;
43end;
44
45procedure TFormMessages.ListView1DblClick(Sender: TObject);
46begin
47 if Assigned(ListView1.Selected) then begin
48 if Assigned(FOnSelect) then
49 FOnSelect(TMessage(ListView1.Selected.Data).Position);
50 end;
51end;
52
53procedure TFormMessages.Reload;
54begin
55 ListView1.Items.Count := Core.Core.Assembler.Message.Count;
56 ListView1.Refresh;
57end;
58
59end.
60
Note: See TracBrowser for help on using the repository browser.