Bonjour,

J'ai 1 Form contenant 1 Panel qui contient 1 ScrollBox dans laquelle je créé des listbox non visibles en runtime.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
 
with TListBox.Create(ScrollBox1) do begin
   Name:='lboxContrainte'+RightStr('00'+IntToStr(j+1),3);
   Visible:=False;
   Parent:=ScrollBox1;
   Items:=InfoContrainte;
   Top:=20; Left:=20;
   Height:=250;
   width:=200;
end;
Au survol d'un TLabel, je souhaite rendre visible la listbox associée:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
 
procedure TForm2.ContrainteMouseEnter(Sender:TObject);
var numContrainte:string;
begin
     numContrainte:=RightStr((Sender as TLabel).Name,3);
     with TListBox(FindComponent('lboxContrainte'+numContrainte)) do Visible:=True;
end;
Bien sûr le mouseLeave est prévu pour la cacher

Pb: le
Code : Sélectionner tout - Visualiser dans une fenêtre à part
with TListBox(FindComponent('lboxContrainte'+numContrainte)) do Visible:=True
génère une violation d'accès...lecture de 0x0..69

Un avis ?

Merci d'avance.