Pb pour rendre visible 1 Listbox dynamique
Bonjour,
J'ai 1 Form contenant 1 Panel qui contient 1 ScrollBox dans laquelle je créé des listbox non visibles en runtime.
Code:
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:
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 8-)
Pb: le
Code:
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.