Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How Connect Scroll Mouse in DBGRID

177 views
Skip to first unread message

Ryekenzo

unread,
Aug 14, 2005, 3:55:13 AM8/14/05
to
How to connect Scroll Mouse in dbgrid. if i want to roll scroll mouse
dbgrid up and down can display change record. pls sample.

Peter Below (TeamB)

unread,
Aug 14, 2005, 5:27:24 AM8/14/05
to
In article <nvttf114p933jdeo1...@4ax.com>, Ryekenzo
wrote:

>
> How to connect Scroll Mouse in dbgrid. if i want to roll scroll mouse
> dbgrid up and down can display change record. pls sample.

You can use the forms OnMousewheel event:

procedure TForm1.FormMouseWheel(Sender: TObject; Shift: TShiftState;
WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
Var
msg: Cardinal;
code: Cardinal;
i, n: Integer;
begin
If WindowFromPoint( mouse.Cursorpos ) = dbgrid1.Handle Then Begin
Handled := true;
If ssShift In Shift Then
msg := WM_HSCROLL
Else
msg := WM_VSCROLL;

If WheelDelta < 0 Then
code := SB_LINEUP
Else
code := SB_LINEDOWN;

n:= Mouse.WheelScrollLines;
For i:= 1 to n Do
dbgrid1.Perform( msg, code, 0 );
dbgrid1.Perform( msg, SB_ENDSCROLL, 0 );
End;
end;

--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be


0 new messages