Notified when child control gets focus

J

Jim

Is there a simple way other than looping through each child control of a
panel and subscribing to the GotFocus event for each child control?

What I want is if any control gets focus inside a panel, I then raise a
custom event.

Thanks,
-Jim
 
B

Brandon Owensby

Jim,
Now obviously something has to run somewhere that runs this event of
yours. Unfortunatly to my knowledge this isn't an event that will fire on
the panel letting you know that focus was just gained on a control inside
the panel. However there is a method call ContainsFocus that will let you
know at anytime if focus is on that control on or any of its child controls.
This might be helpful if you decide to use a timer event. A timer event
would periodically check to see if your panel contains focus and if so run
your custom event. It could check anywhere from once a millisecond to once
a minute or more. The timer if you haven't used one works off another
thread so you won't have to worry about it getting in the way of your normal
processing. Hope this helps. If you need anymore information respond to
this and I'll be watching.

Brandon
 

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

Similar Threads


Top