467,075 Members | 954 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,075 developers. It's quick & easy.

Determine when mousewheel stops moving?

In a database search application (vb2005), the user wants to be able to
scroll through records using the mousewheel. The data display form contains
textboxes for the main data and a datagridview for the detail data for each
main record. The form also contains btnBegining, btnPrevious, btnNext,
btnEnd.

In the btnNext.MouseWheel event I can increment/decrement the main data
currencymanager position of the main dataset (depending on e.Delta of the
mousewheel event - pos/neg value). If I increment/decrement the
currencyManager.Position the textboxes on the form populate with the
corresponding record's data (textboxes are bound to the dataset.Table). But
I have to load the detail data for each record separately - I am not pulling
and storing all the detail data for the maindata (too much data). So each
time the mousewheel rolls - I increment currencyManager.Position +=1 and I
call another proc to load the detail data per a recordID. This works fine.

My problem is that I also have to load some other stuff when a desired
record is retrieved. Rather than calling a bunch of procs for each click of
the mousewheel, I only increment/decrement the currencyManager.Position and
load the Detail data for each record. What I want to do is when the
mousewheel stops moving for say 500 ms, call the other procs.

I have a similar routine for holding down btnNext.KeyDown. It cycles
through records in a loop. On the KeyUp event I set a flag to get out of the
loop and the rest of the procs run. I want to do the same thing with the
mousewheel event. But how do I detect when the mousewheel stops moving?
What event can I use to set a flag that the mousewheel has stopped moving to
run the rest of the procs? I am thinking something like Thread.Sleep(500),
but I don't think I want to add that to the Mousewheel event.

Any suggestions appreciated.

Thanks,
Rich
Mar 22 '07 #1
  • viewed: 2153
Share:
1 Reply
One thought I have on this issue is to use a Timer object to poll when the
mouseWheel stops moving by constantly read the e.Delta values, but now I will
need to use a Delegate I think for the Timer object to be able to communicate
with the MouseWheel event. Anyway, it is just a thought.

Any suggestions appreciated if I am going in the right dirrection, and how I
might implement the Delegate.
"Rich" wrote:
In a database search application (vb2005), the user wants to be able to
scroll through records using the mousewheel. The data display form contains
textboxes for the main data and a datagridview for the detail data for each
main record. The form also contains btnBegining, btnPrevious, btnNext,
btnEnd.

In the btnNext.MouseWheel event I can increment/decrement the main data
currencymanager position of the main dataset (depending on e.Delta of the
mousewheel event - pos/neg value). If I increment/decrement the
currencyManager.Position the textboxes on the form populate with the
corresponding record's data (textboxes are bound to the dataset.Table). But
I have to load the detail data for each record separately - I am not pulling
and storing all the detail data for the maindata (too much data). So each
time the mousewheel rolls - I increment currencyManager.Position +=1 and I
call another proc to load the detail data per a recordID. This works fine.

My problem is that I also have to load some other stuff when a desired
record is retrieved. Rather than calling a bunch of procs for each click of
the mousewheel, I only increment/decrement the currencyManager.Position and
load the Detail data for each record. What I want to do is when the
mousewheel stops moving for say 500 ms, call the other procs.

I have a similar routine for holding down btnNext.KeyDown. It cycles
through records in a loop. On the KeyUp event I set a flag to get out of the
loop and the rest of the procs run. I want to do the same thing with the
mousewheel event. But how do I detect when the mousewheel stops moving?
What event can I use to set a flag that the mousewheel has stopped moving to
run the rest of the procs? I am thinking something like Thread.Sleep(500),
but I don't think I want to add that to the Mousewheel event.

Any suggestions appreciated.

Thanks,
Rich
Mar 22 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

18 posts views Thread by Christopher W. Douglas | last post: by
6 posts views Thread by deko | last post: by
reply views Thread by Mark Johnson | last post: by
7 posts views Thread by Daisy | last post: by
1 post views Thread by Nicholas Shewmaker | last post: by
3 posts views Thread by Dave K | last post: by
6 posts views Thread by Bob Johnson | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.