AdvScrollBox - How to scroll it with mouseWheel

Hello Guys

I have an AdvScrollBox1 in my form with many components, I want to scroll my AdvScrollBox1 with MouseWheel and I'd like to know if it is possible and if so, how can I do that.

Thanks
Alex

You can use MouseWheel... events and ScrollBy etc. to handle it.

Hi,



I do this with TScrollBox, but you have to call ScrollBox.SetFocus from ScrollBox MouseEnter to get it to work

properly.



I have not tested it with AdvScrollBox, but it should work:



procedure TForm1.ScrollBox1MouseEnter(Sender: TObject);

begin

  ScrollBox1.SetFocus;

end;



procedure TForm1.ScrollBox1MouseWheelDown(Sender: TObject;

  Shift: TShiftState; MousePos: TPoint; var Handled: Boolean);

begin

  Handled := SendMessage( ScrollBox1.Handle, WM_VSCROLL, SB_LINEDOWN, 0 ) = 0;

end;



procedure TForm1.ScrollBox1MouseWheelUp(Sender: TObject; Shift: TShiftState;

  MousePos: TPoint; var Handled: Boolean);

begin

  Handled := SendMessage( ScrollBox1.Handle, WM_VSCROLL, SB_LINEUP, 0 ) = 0;

end;



Kind Regards,

Marco.