Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / July 2006

Tip: Looking for answers? Try searching our database.

User input focus detecting?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Pieter Breed - 05 Jul 2006 03:44 GMT
Hi,

Is there a way to determine if your winform application has the current
user focus?

I am looking to implement something that works somewhat like Outlook's
new email notify window. The specific behaviour that I am trying to
replicate is that if you don't give attention to the window it fades
out again after a while, but if you hover over it or click on it it
does not.

So my windows must fade in, show something, and only if you didn't
click on it (ie give it focus) then fade out again.

Regards,
Pieter
Joris Zwaenepoel - 05 Jul 2006 07:06 GMT
Hi Pieter,

I think you should you the MouseHover event of the form to detect if tthe
user wants to activate your notification form, and then activate the form and
disable your "fadeout timer".

You can test which event is fired like this:

   Private Sub Form1_MouseEnter(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.MouseEnter
       Debug.WriteLine("MouseEnter")
   End Sub

   Private Sub Form1_MouseLeave(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.MouseLeave
       Debug.WriteLine("MouseLeave")
   End Sub

   Private Sub Form1_MouseHover(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.MouseHover
       Debug.WriteLine("MouseHover")
   End Sub

Hope this helps,

Joris

> Hi,
>
[quoted text clipped - 12 lines]
> Regards,
> Pieter
http://www.bit-kit.com - 05 Jul 2006 07:16 GMT
Hi Pieter!

What about simply using the someForm.Focused boolean property?

- Peder -
Pieter Breed - 05 Jul 2006 17:24 GMT
Thanks,

will give it a try :)

pieter

> Hi Pieter!
>
> What about simply using the someForm.Focused boolean property?
>
> - Peder -

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.