Board index » delphi » Help: How to intercept (triggering) a scroll-bar action

Help: How to intercept (triggering) a scroll-bar action

How can I intercept (triggering) a scroll bar evnts of a user (in a DBGrid
for exemple)?

Thank you foryour help.

Ariel

 

Re:Help: How to intercept (triggering) a scroll-bar action


In article <4cbogf$...@asterix.rain.fr>, Peri...@dx-net.fr says...

Quote

>How can I intercept (triggering) a scroll bar evnts of a user (in a DBGrid
>for exemple)?

>Thank you foryour help.

>Ariel

For just a form, you add a message handler for WM_VSCROLL, WM_HSCROLL.
By avoiding calling inherited, you can even prevent the parent form from
dealing with it.

For a DBGrid, you may have to subclass it (ie make a new component) so
that you can put in the code for these messages.  If you subclass it,
I would recommend that you add 2 Events (OnHorzScroll, OnVertScroll) and
pass them both a VAR param that lets the event determine if the parent
should be notified (if you need that functionality).

Then your message Handler will look something like: {excuse roughness}

procedure MSG_VSCROLL(var Msg: TWM_VSCROLL); Message ...
Var
 bFlag: Boolean;
Begin
  If OnVertScroll Then {Call the OnScrollEvent}
  If bFlag then inherited;
End;

HTH,
___________________________________________________________________________
Kirk Wolak
KWo...@mail.cbf.com
//
// Const ViewsExpressed = "My own and not those of the company I work for!";
//

Other Threads