imagine that I have a Form with 9 controls (TabbedStuffControl) in a 3×3 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.
Using the Enter event (better then GotFocus) is certainly a good approach. Subscribe a handler for all controls, then go find the parent of the control in the Enter event handler. This sample code demonstrates the approach: