Determine when mousewheel stops moving?

G

Guest

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
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top