🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #3057

Re: DBGrid and MouseWheel

#3057
From: Randel Bjorkquist
Date: Tue, 07 Jan 2003 14:57
130 lines
4887 bytes
Hey Mark,

I just happened accross your code and was very excited because I've had the
same problem, just not the time to really look into it.  I will also admit,
I still consider myself very much a novice when it comes to programming and
understanding how all the piece of the puzzle fit together.

What my question is, that I don't understand where to call this code, so how
do I call this code?  I have looked at inserting the code within the
OnMouseWheel Event, but that doesn't look right.  I apologize if this feels
as if I'm asking you to write all my code.  But if you can either tell me or
give me a hit, I would sure appreciate it.

Thanks if you can help,

Randel

"Mark Guerrieri" <mguerrieri@cmsgrp.com> wrote in message
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: <3e1aeac2$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!c03.atl99!news.webusenet.com!news02.tsnz.net!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3e16d6df$1@newsgroups.borland.com> <3e174252$1@newsgroups.borland.com> <3e18b751@newsgroups.borland.com> <3e19b869@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-07 07:05:06 PST
From: "Randel Bjorkquist" <rbjorkquist@coilcraft.com>
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>
Subject: Re: DBGrid and MouseWheel
Date: Tue, 7 Jan 2003 08:57:07 -0600
Lines: 132
Organization: Coilcraft, Inc.
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: 209.172.185.194
Message-ID: <3e1aeac2$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1041951426 209.172.185.194 (7 Jan 2003 06:57:06 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!c03.atl99!news.webusenet.com!news02.tsnz.net!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail