The code below seems to work but it also seems a bit slow. Maybe I'm doing something badly? Make a new application, put a TListBox (with enough items to show a vertical scroll bar) and a TEdit on the form. I use this with a TScrollBox (hence WM_HSCROLL and WM_MouseWheel) and it seems OK.
You could also look at: http://community.borland.com/article/0,1410,15942,00.html and http://www.efg2.com/Lab/Library/UseNet/2000/0602.txt which describe the same problem for TScrollBox Rob 8< --------------------------------------------------------------- unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TForm1 = class(TForm) Edit1: TEdit; ListBox1: TListBox; procedure FormCreate(Sender: TObject); private { Private declarations } ListBoxProc: TWndMethod; procedure ListBoxWindowProc(var Mess: TMessage); public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject); begin ListBoxProc := ListBox1.WindowProc; ListBox1.WindowProc := ListBoxWindowProc; end; procedure TForm1.ListBoxWindowProc(var Mess: TMessage); begin ListBoxProc(Mess); if ((Mess.Msg = WM_VSCROLL) or (Mess.Msg = WM_HSCROLL) or (Mess.msg = WM_Mousewheel)) then // < Do your stuff > / eg Edit1.Text := 'TopIndex is '+IntToStr(ListBox1.TopIndex); end; end. 8< --------------------------------------------------------------- -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.1.362 / Virus Database: 267.13.8/184 - Release Date: 27/11/2005 _______________________________________________ Delphi mailing list -> [email protected] http://www.elists.org/mailman/listinfo/delphi

