mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Component: Give away keyboard focus when disabled
This commit is contained in:
parent
a852f4f45f
commit
3fac215534
1 changed files with 9 additions and 0 deletions
|
|
@ -3007,6 +3007,15 @@ void Component::setEnabled (bool shouldBeEnabled)
|
|||
|
||||
BailOutChecker checker (this);
|
||||
componentListeners.callChecked (checker, [this] (ComponentListener& l) { l.componentEnablementChanged (*this); });
|
||||
|
||||
if (! shouldBeEnabled && hasKeyboardFocus (true))
|
||||
{
|
||||
if (parentComponent != nullptr)
|
||||
parentComponent->grabKeyboardFocus();
|
||||
|
||||
// ensure that keyboard focus is given away if it wasn't taken by parent
|
||||
giveAwayKeyboardFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue