How to scroll the content of 2 listboxes in the same time? lazarus / 31-LCL ---------------------------------------------------------------------- Peter_Vadasz · 2012-12-26 15:06 Hello everybody, Is there any easy way to scroll the content of 2 listboxes in the same time? If I set the MouseWheel event and set the Listbox1.TopIndex:=Listbox2.Topindex is working but it works only with mousewheel, and the lines of the listboxes aren't in sync. I tried to google it, and I found this http://www.delphipages.com/forum/showthread.php?t=164288 but it isn't work under linux. Lazarus version: 1.0.4 Operating System Linux Mint 13. Thanks for every useable advice! Peter ---------------------------------------------------------------------- Blaazen · 2012-12-26 15:34 Property TopIndex works on both Qt and GTK2, but OnMouseWheel doesn't (in Qt). Maybe there is no cross-platform solution for this. If you need two columns of text with fully synchronous scrolling, TListBox.Columns=2 will not work either. Solution can be TStringGrid. ---------------------------------------------------------------------- Peter_Vadasz · 2012-12-27 06:33 Thanks for your reply! I think I'm going to try to solve the "problem" with StringGrid or other components. ---------------------------------------------------------------------- eny · 2012-12-27 09:00 VirtualTreeView is quite easy to set up when displaying just text strings and gives you a lot of config possibilities. ---------------------------------------------------------------------- howardpc · 2012-12-27 22:30 If you want to synchronise the listboxes only when one or other has focus, you could use the OnIdle event like this with two listboxed named lbL and lbR Code: [Select]  TForm1 = class(TForm)     lbL: TListBox;     lbR: TListBox;     procedure FormCreate(Sender: TObject);   private     procedure SyncLBs(Sender: TObject; var Done: Boolean);   end; var Form1: TForm1; implementation {$R *.lfm} procedure TForm1.FormCreate(Sender: TObject); begin   Application.OnIdle:=@SyncLBs; end; procedure TForm1.SyncLBs(Sender: TObject; var Done: Boolean) ; var lb: TListBox; begin   if lbL.Focused then    lbR.TopIndex:= lbL.TopIndex   else if lbR.Focused    then lbL.TopIndex:= lbR.TopIndex; end; ---------------------------------------------------------------------- Peter_Vadasz · 2012-12-28 09:24 howardpc, thank you so much! It works very well.