Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Timed MouseMove 1

Status
Not open for further replies.

XTnCIS

Programmer
Apr 23, 2002
57
US
I have a state map of all the counties in Tennessee with little buttons over each county (buttons are transparent and can't really be seen by the user). There is a drop-down on the form that is automatically updated with the county name when the user points at each county (MouseMove event for the button that is possitioned over the county).

However, I would like to delay in the update to the drop-down so that the county name is only updated if the user has pointed to the county for about 1/2 a second.

This would allow enough of a delay for the user to move the mouse off the map and still have the county selected that was selected prior to moving the mouse off the map. (Moving the mouse off the map causes the user to point to several other counties...)

Hope this makes since - does anybody have any ideas?
 
How about this:
1. Create a global variable to hold the selected county.
2. In the MouseMove event, compare the global variable to the county name for the button they're pointing to. If it's not equal, update the global variable and set the form's TimerInterval property to 500 (1/2 second). If it is equal, just exit.
3. In the Form_Timer event, use the global variable to set the combo box and then reset TimerInterval to 0.

While the user is mousing over the map, the timer interval will repeatedly keep being set to 500, so the timer won't go off unless they stay within one button for 1/2 second.

Only one problem that I can think of: If they move the pointer off the map, you'd want to reset the TimerInterval to 0 in order to avoid selecting the county. You might be able to do that with the Form_MouseMouse event, but it depends somewhat on the design of your form. Even if that doesn't work, though, this is pretty close to what you asked for. Rick Sprague
 
Thanks for your help!

It worked like a charm. [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top