471,350 Members | 1,711 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,350 software developers and data experts.

Hover delay?

I want to introduce a one-second delay into the MouseHover event of a label.
In other words, I want the user to have to hover over a label for one second
before the label's MouseHover event triggers a response from the
application.

Here's what I've got so far:

-- Add a timer control and a bolean DoAction flag to the form.

-- Set DoAction flag to false and the timer for a one second interval.

-- Start the timer when the label's mouseEnter event fires.

-- When the label's MouseHover event fires, exit the event handler as long
as the DoAction flag is false.

-- When the timer fires it's interval event, set the DoAction flag to true.

The next MouseHover event will trigger the response to that event.

This approach seems more complicated than it needs to be. Is there a simpler
way to accomplish the same thing?

Thanks in advance.

--
David Veeneman
Foresight Systems
Jan 17 '06 #1
1 4376
So you keep getting MouseHover events as long as the mouse is hovering (as
opposed to just getting one MouseHover event)? I'm not intimately familiar
with how that event is fired, hence my question.

If you are getting multiple events, why bother with the timer at all. Why
not just use something like GetTickCount( ) (I'm referring to Win32 API -
whatever the c# equivalent is) and check if more than X milliseconds have
elapsed.

The timer here seems superfluous since I don't believe you need the
asynchronicity that the timer gives you.

Kevin

"David Veeneman" <da****@nospam.com> wrote in message
news:uo**************@TK2MSFTNGP15.phx.gbl...
I want to introduce a one-second delay into the MouseHover event of a
label. In other words, I want the user to have to hover over a label for
one second before the label's MouseHover event triggers a response from the
application.

Here's what I've got so far:

-- Add a timer control and a bolean DoAction flag to the form.

-- Set DoAction flag to false and the timer for a one second interval.

-- Start the timer when the label's mouseEnter event fires.

-- When the label's MouseHover event fires, exit the event handler as long
as the DoAction flag is false.

-- When the timer fires it's interval event, set the DoAction flag to
true.

The next MouseHover event will trigger the response to that event.

This approach seems more complicated than it needs to be. Is there a
simpler way to accomplish the same thing?

Thanks in advance.

--
David Veeneman
Foresight Systems

Jan 19 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by LRW | last post: by
12 posts views Thread by Sander Tekelenburg | last post: by
1 post views Thread by Ricky | last post: by
5 posts views Thread by Adriano | last post: by
7 posts views Thread by Anthony | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.