I'm trying to figure out why these two lines of code sometimes return different values:
var focus = FindFocusedControl(_targetForm).Name;
var active = _targetForm.ActiveControl.Name;
FindFocusedControl
comes from here:
private static Control FindFocusedControl(Control control)
{
var container = control as ContainerControl;
while (container != null)
{
control = container.ActiveControl;
container = control as ContainerControl;
}
return control;
}
Is my active
simply the one least able to be drilled down into? Does it depend on whether the control that actually has focus is inside a UserControl
?