Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Smooth Scroll DBGrid with AfterScroll


This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 3 - Last Post: Jan 24, 2016 12:21 AM Last Post By: mohamed alayadi
mohamed alayadi

Posts: 17
Registered: 8/26/02
Smooth Scroll DBGrid with AfterScroll  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 20, 2015 4:06 AM
I have a TDBGrid linked to a TDataset which has an AfterScroll event. This event makes some checks and takes some time.
I want to execute this event only when scrolling the DBGrid has ended and not while scrolling it.
Now the event fires on every click in the DBGrid's vertical scroll bar and this makes the scroll so lengthy, and when the mouse is released it continues scrolling.
The ideal will be to scroll the DBGrid without this event firing until the scroll is stopped.
Thnx for help..

Edited by: mohamed alayadi on Nov 20, 2015 1:07 PM
Peter Below

Posts: 1,227
Registered: 12/16/99
Re: Smooth Scroll DBGrid with AfterScroll [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 20, 2015 9:35 AM   in response to: mohamed alayadi in response to: mohamed alayadi
mohamed alayadi wrote:

I have a TDBGrid linked to a TDataset which has an AfterScroll event.
This event makes some checks and takes some time. I want to execute
this event only when scrolling the DBGrid has ended and not while
scrolling it. Now the event fires on every click in the DBGrid's
vertical scroll bar and this makes the scroll so lengthy, and when
the mouse is released it continues scrolling. The ideal will be to
scroll the DBGrid without this event firing until the scroll is
stopped. Thnx for help..

Edited by: mohamed alayadi on Nov 20, 2015 1:07 PM

You can check the state of the mouse button and if the button is still
down exit the event handler directly.

if GetKeyState( VK_LBUTTON ) < 0 then
exit;

--
Peter Below
TeamB

mohamed alayadi

Posts: 17
Registered: 8/26/02
Re: Smooth Scroll DBGrid with AfterScroll [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 16, 2015 8:07 AM   in response to: Peter Below in response to: Peter Below
Peter Below wrote:

You can check the state of the mouse button and if the button is still
down exit the event handler directly.

if GetKeyState( VK_LBUTTON ) < 0 then
exit;

--
Peter Below
TeamB


I think this code is insufficient because it deactivates the event handler AfterScroll which does not fire when mouse has stopped.
This event may only be for clicking with mouse in the scroll bar, AfterScroll fires also on scrolling the grid with keyboard keys and mouse wheel.
I hope someone can help me with this..
mohamed alayadi

Posts: 17
Registered: 8/26/02
Re: Smooth Scroll DBGrid with AfterScroll [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 24, 2016 12:21 AM   in response to: mohamed alayadi in response to: mohamed alayadi
I have resolved it with :

If Dataset.ControlsDisabled then ..

Thnx for any interest :)

mohamed alayadi wrote:
Peter Below wrote:

You can check the state of the mouse button and if the button is still
down exit the event handler directly.

if GetKeyState( VK_LBUTTON ) < 0 then
exit;

--
Peter Below
TeamB


I think this code is insufficient because it deactivates the event handler AfterScroll which does not fire when mouse has stopped.
This event may only be for clicking with mouse in the scroll bar, AfterScroll fires also on scrolling the grid with keyboard keys and mouse wheel.
I hope someone can help me with this..
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02