- procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG;
- var Handled: Boolean);
- begin
- // Il faut intercepter les messages de la roulette
- // pour déplacer la deuxième ListBox
- If (Msg.Message=WM_MOUSEWHEEL)And(Screen.ActiveForm=Form1)
- Then Begin
- If ActiveControl=ListBox1 Then SendMessage(ListBox2.Handle,WM_MOUSEWHEEL,MSG.wParam,MSG.lParam);
- If ActiveControl=ListBox2 Then SendMessage(ListBox1.Handle,WM_MOUSEWHEEL,MSG.wParam,MSG.lParam);
- End;
- // Il faut aussi intercepter les messages reçus sur les barres
- // de défilement.
- If ((Msg.Message=WM_NCLBUTTONDOWN)Or(Msg.Message=WM_NCMOUSEMOVE))
- And(Screen.ActiveForm=Form1)
- Then Begin
- If ActiveControl=ListBox1 Then ListBox2.TopIndex:=ListBox1.TopIndex;
- If ActiveControl=ListBox2 Then ListBox1.TopIndex:=ListBox2.TopIndex;
- End;
- end;
-
- procedure TForm1.ListBox1Click(Sender: TObject);
- begin
- // Ici c'est pour les synchronisation quand ItemIndex change
- ListBox2.TopIndex:=ListBox1.TopIndex;
- end;
-
- procedure TForm1.ListBox2Click(Sender: TObject);
- begin
- // Ici c'est pour les synchronisation quand ItemIndex change
- ListBox1.TopIndex:=ListBox2.TopIndex;
- end;
-
procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG;
var Handled: Boolean);
begin
// Il faut intercepter les messages de la roulette
// pour déplacer la deuxième ListBox
If (Msg.Message=WM_MOUSEWHEEL)And(Screen.ActiveForm=Form1)
Then Begin
If ActiveControl=ListBox1 Then SendMessage(ListBox2.Handle,WM_MOUSEWHEEL,MSG.wParam,MSG.lParam);
If ActiveControl=ListBox2 Then SendMessage(ListBox1.Handle,WM_MOUSEWHEEL,MSG.wParam,MSG.lParam);
End;
// Il faut aussi intercepter les messages reçus sur les barres
// de défilement.
If ((Msg.Message=WM_NCLBUTTONDOWN)Or(Msg.Message=WM_NCMOUSEMOVE))
And(Screen.ActiveForm=Form1)
Then Begin
If ActiveControl=ListBox1 Then ListBox2.TopIndex:=ListBox1.TopIndex;
If ActiveControl=ListBox2 Then ListBox1.TopIndex:=ListBox2.TopIndex;
End;
end;
procedure TForm1.ListBox1Click(Sender: TObject);
begin
// Ici c'est pour les synchronisation quand ItemIndex change
ListBox2.TopIndex:=ListBox1.TopIndex;
end;
procedure TForm1.ListBox2Click(Sender: TObject);
begin
// Ici c'est pour les synchronisation quand ItemIndex change
ListBox1.TopIndex:=ListBox2.TopIndex;
end;