source: OniTrainer/current/Unit7.pas@ 1080

Last change on this file since 1080 was 251, checked in by alloc, 17 years ago
File size: 3.3 KB
Line 
1unit Unit7;
2
3interface
4
5uses
6 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7 Dialogs, Grids, StrUtils,Unit8;
8
9type
10 TForm7 = class(TForm)
11 grid: TStringGrid;
12 procedure FormResize(Sender: TObject);
13 procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
14 procedure FormCreate(Sender: TObject);
15 private
16 { Private declarations }
17 public
18 { Public declarations }
19 end;
20
21var
22 Form7: TForm7;
23
24PROCEDURE Check_CharInOverview(charnumber:Byte);
25FUNCTION GetCharOverviewCol(charnumber:Byte):Byte;
26
27implementation
28
29uses unit1, unit2, unit3;
30{$R *.dfm}
31
32PROCEDURE Check_CharInOverview(charnumber:Byte);
33 VAR i,colchar:Byte;
34 found:Boolean;
35 BEGIN
36 found:=False;
37 FOR i:=2 TO Form7.grid.ColCount-1 DO BEGIN
38 IF NOT found=True THEN BEGIN
39 IF StrLen(PChar(Form7.grid.Cells[i,0]))>0 THEN BEGIN
40 colchar:=StrToInt(MidStr(Form7.grid.Cells[i,0], 3, 10));
41 IF colchar=charnumber THEN BEGIN
42 found:=True;
43 IF NOT _ais_active[charnumber]=TRUE THEN BEGIN
44 Form7.grid.Cells[i,0]:=Form7.grid.Cells[i+1,0];
45 Form7.grid.Cells[i+1,0]:='';
46 END ELSE exit;
47 END;
48 END;
49 END ELSE BEGIN
50 IF i<Form7.grid.ColCount-1 THEN BEGIN
51 Form7.grid.Cells[i,0]:=Form7.grid.Cells[i+1,0];
52 Form7.grid.Cells[i+1,0]:='';
53 END;
54 END;
55 END;
56 IF (found=True) AND (_ais_active[charnumber]=FALSE) THEN Form7.grid.ColCount:=Form7.grid.ColCount-1;
57 IF (found=False) AND (_ais_active[charnumber]=TRUE) THEN BEGIN
58 Form7.grid.ColCount:=Form7.grid.ColCount+1;
59 FOR i:=Form7.grid.ColCount-1 DOWNTO 2 DO BEGIN
60 IF StrLen(PChar(Form7.grid.Cells[i,0]))>0 THEN BEGIN
61 colchar:=StrToInt(MidStr(Form7.grid.Cells[i,0], 3, 10));
62 IF colchar>charnumber THEN BEGIN
63 Form7.grid.Cells[i+1,0]:=Form7.grid.Cells[i,0];
64 END ELSE BEGIN
65 Form7.grid.Cells[i+1,0]:='AI'+IntToStr(charnumber);
66 exit;
67 END;
68 END;
69 IF i=2 THEN Form7.grid.Cells[i,0]:='AI'+IntToStr(charnumber);
70 END;
71 END;
72 END;
73
74FUNCTION GetCharOverviewCol(charnumber:Byte):Byte;
75 VAR i,colchar:Byte;
76 BEGIN
77 FOR i:=2 TO Form7.grid.ColCount-1 DO BEGIN
78 IF StrLen(PChar(Form7.grid.Cells[i,0]))>0 THEN BEGIN
79 colchar:=StrToInt(MidStr(Form7.grid.Cells[i,0], 3, 10));
80 IF colchar=charnumber THEN BEGIN result:=i; exit; END;
81 END;
82 END;
83 result:=0;
84 END;
85
86PROCEDURE TForm7.FormCreate(Sender: TObject);
87 VAR i:Byte;
88 BEGIN
89 grid.RowCount:=number_items+1;
90 grid.Height:=(number_items+1)*17+4;
91 Form7.Height:=grid.Height+22;
92 grid.ColCount:=2;
93 grid.FixedCols:=1;
94 grid.FixedRows:=1;
95 grid.ColWidths[0]:=120;
96 grid.Cells[0,0]:=' ';
97 FOR i:=1 TO number_items DO BEGIN
98 grid.Cols[0].Add(CharDataStuff[i].overview_name);
99 END;
100 grid.Rows[0].Add('Player')
101 END;
102
103PROCEDURE TForm7.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
104 BEGIN
105 Self.Visible:=False;
106 CanClose:=False;
107 CharOverviewMenu.Checked:=False;
108 END;
109
110PROCEDURE TForm7.FormResize(Sender: TObject);
111 BEGIN
112 Form7.Height:=grid.Height+24;
113 grid.Width:=Form7.Width-8;
114 IF Form7.Width<300 THEN Form7.Width:=300;
115 END;
116
117END.
Note: See TracBrowser for help on using the repository browser.