How to let parent control know that its child got focus?

Posted by Axarydax on Stack Overflow See other posts from Stack Overflow or by Axarydax
Published on 2010-03-23T12:06:03Z Indexed on 2010/03/23 12:23 UTC
Read the original article Hit count: 366

Filed under:
|
|

Hi there, imagine that I have a Form with 9 controls (TabbedStuffControl) in a 3x3 tile, and these controls contain TabControls containing another control (StuffControl) with ListBoxes and TextBoxes.

I'd like to know a proper way to let TabbedStuffControl that its child has received a focus? e.g. user clicks into a textbox of StuffControl or drags something to listbox of StuffControl. Eventually the Form should know which TabbedStuffControl is active

Do I need to hook up GotFocus event of TextBoxes and ListBoxes and TabControls, then dispatch another event to finally let Form know who got focus? I think that there should be a simpler way - that somehow TabbedStuffControl knows that its child got focus, so there would be only one place in code that I'll hook up.

Thanks.

© Stack Overflow or respective owner

Related posts about focus

Related posts about winforms