Article View: borland.public.cppbuilder.database.ado
Article #3070Re: DBGrid and MouseWheel
From: Mark Guerrieri
Date: Sun, 12 Jan 2003 21:06
Date: Sun, 12 Jan 2003 21:06
132 lines
4948 bytes
4948 bytes
Well, technically, it should only work if the DBGrid is selected. All mouse
wheel events are only directed to the window with the focus. Try the
following- open 2 browser windows that can be scrolled, mouse over the
non-focused one and scroll the mouse- nothing happens...
Mark
"Ricardo Manuel Santos Rodrigues" <ricardo.rodrigues@oesteconta.org> wrote
in message news:3e1c3595$1@newsgroups.borland.com...
> it only works if the dbgrid is selected... is there any code that work
when
> mouse pointer is on the dbgrid?
>
> --Ricardo
>
>
> "Mark Guerrieri" <mguerrieri@cmsgrp.com> escreveu na mensagem
> news:3e19b869@newsgroups.borland.com...
> > Ok, here you go... this will handle ant TDBGrids in your app and scroll
> them
> > correctly... I am using BCB6 sp2...
> >
> > void __fastcall TForm1::ApplicationEvents1Message(tagMSG &Msg,
> > bool &Handled)
> > {
> > static int deltaUp = 0;
> > static int deltaDown = 0;
> >
> > if(Msg.message == WM_MOUSEWHEEL)
> > {
> > if(Screen->ActiveForm &&
> > dynamic_cast<TDBGrid*>(Screen->ActiveForm->ActiveControl))
> > {
> > short zDelta = (short) HIWORD(Msg.wParam);
> > bool bUp = false;
> > bool bDown = false;
> > if(zDelta == 0)
> > return;
> > if(zDelta > 0)
> > {
> > deltaUp+= zDelta;
> > deltaDown = 0;
> > bUp = true;
> > }
> > else
> > {
> > deltaDown+= zDelta;
> > deltaUp = 0;
> > bDown = true;
> > }
> >
> > if(bUp && deltaUp >= WHEEL_DELTA)
> > {
> > deltaUp = 0;
> > Msg.message = WM_KEYDOWN;
> > Msg.lParam = 0;
> > Msg.wParam = VK_UP;
> > }
> > else if(bDown && (deltaDown * -1) >= WHEEL_DELTA)
> > {
> > deltaDown = 0;
> > Msg.message = WM_KEYDOWN;
> > Msg.lParam = 0;
> > Msg.wParam = VK_DOWN;
> > }
> > }
> > }
> > }
> >
> >
> > Mark Guerrieri
> > mguerrieri@cmsgrp.com
> >
> >
> > "Ricardo Rodrigues" <madinfo@cadaval.net> wrote in message
> > news:3e18b751@newsgroups.borland.com...
> > > I am interested on that code too
> > > tanks
> > >
> > > --Ricardo
> > >
> > >
> > > "Mark Guerrieri" <markg11@comcast.net> wrote in message
> > > news:3e174252$1@newsgroups.borland.com...
> > > > This is a known issue with TDBGrid. You need to add a routine to
> > globally
> > > > handle mouse wheel messages (write a TApplicationEvents->OnMessage
> event
> > > > handler), check to see if the window with input focus is a TDBGrid
and
> > if
> > > it
> > > > is, manually scroll the grid. When I get back to the office on
> Monday,
> > > I'll
> > > > post the code I use if someone else hasn't by then.
> > > >
> > > > Mark Guerrieri
> > > > mguerrieri@cmsgrp.com
> > > >
> > > > "Alen Markov" <NOSPAM_amarkov@gmx.net> wrote in message
> > > > news:3e16d6df$1@newsgroups.borland.com...
> > > > > Just curious:
> > > > >
> > > > > Let's say you have a DGGrid with total 1000 rows.
> > > > > The DBGrid is positioned on the screen in a size
> > > > > that only the first 15rows are displayed
> > > > > (Properties - Options are all left on their defaultvalues)
> > > > >
> > > > > When you scroll down now with the mousewheel,
> > > > > it works fine until the "cursor" (the current cell is marked blue)
> > > > > reaches the row number 15... means you can only scroll
> > > > > between rows 1 and 15, but not further...
> > > > >
> > > > > Is it possible to adjust somehow the behaviour of a DBGrid
> > > > > so you can scroll through all rows with the mousewheel?
> > > > >
> > > > > Alen
> > > > >
> > > > >
> > > > > --
> > > > > WEB: http://www.come.to/nostromo
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
Technical Details
Message-ID:
<3e21d8e5@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3e16d6df$1@newsgroups.borland.com> <3e174252$1@newsgroups.borland.com> <3e18b751@newsgroups.borland.com> <3e19b869@newsgroups.borland.com> <3e1c3595$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,cc310fafd9ee71eb X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2003-01-12 13:09:31 PST From: "Mark Guerrieri" <markg11@comcast.net> Newsgroups: borland.public.cppbuilder.database.ado References: <3e16d6df$1@newsgroups.borland.com> <3e174252$1@newsgroups.borland.com> <3e18b751@newsgroups.borland.com> <3e19b869@newsgroups.borland.com> <3e1c3595$1@newsgroups.borland.com> Subject: Re: DBGrid and MouseWheel Date: Sun, 12 Jan 2003 16:06:49 -0500 Lines: 134 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 68.44.67.205 Message-ID: <3e21d8e5@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1042405605 68.44.67.205 (12 Jan 2003 13:06:45 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail