Bonjour
Ce post fait suite à celui ci (findstyleresource ne fonctionne pas) où je cherche à faire une TListBox stylisée contenant pour chaque item une TComboBox.
Petit rappel:
Je veux faire ça
Pour cela j'ai créé un style
Et je remplis ma liste de la façon suivante:
Au premier affichage tout se passe bien mais dès que j’agis sur la barre de scroll à droite mes combobox semble se vider
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 lbTirs.Clear; //vide la TlistBox ibatt := -1; if rbBatt1.IsChecked then ibatt := 0; if rbBatt2.IsChecked then ibatt := 1; if rbBatt3.IsChecked then ibatt := 2; laBatt := navEnMain.BatterieN[ibatt]; for itrl := 0 to laBatt.nbTourelles - 1 do begin trl := laBatt.tourelle[itrl]; if Not(trl.estHS) then begin item := TListBoxItem.Create(lbTirs); item.Parent := lbTirs; item.StyleLookup := 'lbBatterieitemstyle'; item.ImageIndex := trl.getfloc; item.Text := trl.description; if item.FindStyleResource<TComboBox>('cbCibles', maCB) then begin maCB.Items.AddObject('----------', nil); iobj := 0; nav := navEnMain.getObjectif(trl, iobj); while nav <> nil do begin maCB.Items.AddObject(nav.getNom, nav); inc(iobj); nav := navEnMain.getObjectif(trl, iobj); end; maCB.ItemIndex := 0; end; end; end;
Une idée???
Partager