1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
|
procedure TForm2.majListeGrpFeux;
var
i, ii: integer;
item: TListBoxItem;
FMXObject: TFMXObject;
img: TImage;
txt: TText;
bmp: TBitmap;
grpF: TGroupeFeu;
trl: TTourelle;
cbos, cbot, cbts: TComboBox;
navC: TNavire;
dist, angT: integer;
begin
lbgrpfeux.Clear;
i := 0;
grpF := navEnMain.getGroupeFeu(i);
while grpF <> nil do
begin
trl := grpF.getTourelle;
item := TListBoxItem.Create(nil);
item.Height := 60;
item.Parent := lbgrpfeux;
if trl.getCategorie = surf then
begin
item.StyleLookup := 'elemGrpFeuxS';
FMXObject := item.FindStyleResource('txtaffuts_S');
if (FMXObject <> nil) and (FMXObject is TText) then
begin
txt := TText(FMXObject);
txt.Text := Format('%.2d', [grpF.getNbAffut]);
end;
FMXObject := item.FindStyleResource('txtcalibre_S');
if (FMXObject <> nil) and (FMXObject is TText) then
begin
txt := TText(FMXObject);
txt.Text := calibres_surf[grpF.getCalibre];
end;
FMXObject := item.FindStyleResource('cbobjectifs_S');
if (FMXObject <> nil) and (FMXObject is TComboBox) then
begin
cbos := TComboBox(FMXObject);
cbos.Clear;
cbos.Items.AddObject('---------', nil);
for ii := 0 to lesNavires.Count - 1 do
begin
navC := TNavire(lesNavires.Items[ii]);
if (navC <> navEnMain) and (navC.getCamp <> navEnMain.getCamp) then
begin
if navEnMain.tirPossible(navC, trl) then
begin
cbos.Items.AddObject(navC.getNom, navC);
end;
end;
end;
cbos.ItemIndex := 0;
end;
end;
if trl.getCategorie = torp then
begin
item.StyleLookup := 'elemGrpFeuxT';
FMXObject := item.FindStyleResource('cbtaillesalve_T');
if (FMXObject <> nil) and (FMXObject is TComboBox) then
begin
cbts := TComboBox(FMXObject);
cbts.Clear;
for ii := 1 to grpF.getNbAffut do
begin
cbts.Items.Add(Format('%d', [ii]));
end;
cbts.ItemIndex := grpF.getNbAffut - 1;
end;
FMXObject := item.FindStyleResource('txtcalibre_T');
if (FMXObject <> nil) and (FMXObject is TText) then
begin
txt := TText(FMXObject);
txt.Text := calibres_torp[grpF.getCalibre];
end;
FMXObject := item.FindStyleResource('cbobjectifs_T');
if (FMXObject <> nil) and (FMXObject is TComboBox) then
begin
cbot := TComboBox(FMXObject);
cbot.Clear;
cbot.Items.AddObject('---------', nil);
for ii := 0 to lesNavires.Count - 1 do
begin
navC := TNavire(lesNavires.Items[ii]);
if (navC <> navEnMain) and (navC.getCamp <> navEnMain.getCamp) then
begin
if navEnMain.tirPossible(navC, trl) then
begin
cbot.Items.AddObject(navC.getNom, navC);
end;
end;
end;
cbot.ItemIndex := 0;
end;
end;
inc(i);
grpF := navEnMain.getGroupeFeu(i);
end;
end; |
Partager