Board index » delphi » TScrollbox help needed.

TScrollbox help needed.

Hello,

Does anyone knows how to trap the onChange event on a TScrollBox ?

I need to be informed of the scrolling event to adapt my display. There is
no onChange or onScroll event on the scrolling bars.

Thanks to all.

 

Re:TScrollbox help needed.


You could use a TScrollBox descendant, but this will only capture scrolling
by the scrollbars, but not by auto-scrolling:

type
  TMyScrollBox = class(TScrollBox)
  private
    FOnScroll: TNotifyEvent;
    procedure WMHScroll(var Message: TWMHScroll); message WM_HSCROLL;
    procedure WMVScroll(var Message: TWMVScroll); message WM_VSCROLL;
  protected
    procedure Scroll; virtual;
  published
    property OnScroll: TNotifyEvent read FOnScroll write FOnScroll;
  end;

procedure TMyScrollBox.WMHScroll(var Message: TWMHScroll);
begin
  inherited;
  Scroll;
end;

procedure TMyScrollBox.WMVScroll(var Message: TWMVScroll);
begin
  inherited;
  Scroll;
end;

procedure TMyScrollBox.Scroll;
begin
  if Assigned(FOnScroll) then
    FOnScroll(Self);
end;

"Marcel" <m.fonda...@4gl.fr> schreef in bericht
news:9972ah$h49$1@front2m.grolier.fr...

Quote
> Hello,

> Does anyone knows how to trap the onChange event on a TScrollBox ?

> I need to be informed of the scrolling event to adapt my display. There is
> no onChange or onScroll event on the scrolling bars.

> Thanks to all.

Other Threads