I click on scrollbar or on left/right scrollbar button ?

How can I detect if I click on left/right DBGrid scrollbar button or inside scrollbar ?
LVL 9
ginsonicAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
ITugayConnect With a Mentor Commented:
Hi ginsonic,

  TForm1 = class(TForm)
  ...
  public
    OldWndProc: TWndMethod;
    procedure XWndProc(var M: TMessage);
  end;

.....

procedure TForm1.XWndProc(var M: TMessage);
begin
  if M.Msg = WM_HScroll then
  begin
    case LOWORD(M.WParam) of
      0: Caption := 'left button';
      1: Caption := 'right button';
      2,3: Caption := 'scroll area';
      5: Caption := 'middle bottom';
      //8: Caption := 'scrolled';
    end;
  end;
  OldWndProc(M);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  OldWndProc := DBGrid1.WindowProc;
  DBGrid1.WindowProc := XWndProc;
end;

------
Igor.
0
 
ginsonicAuthor Commented:
Perfect answer :)
Thanks again, Igor!

Regards,
Nick
0
All Courses

From novice to tech pro — start learning today.