mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-13 00:04:19 +00:00
Ensure that keyboard focus is always given away when components are made invisible
This commit is contained in:
parent
f647c54b74
commit
33dd896ab2
1 changed files with 4 additions and 3 deletions
|
|
@ -489,7 +489,7 @@ Component::~Component()
|
|||
|
||||
if (parentComponent != nullptr)
|
||||
parentComponent->removeChildComponent (parentComponent->childComponentList.indexOf (this), true, false);
|
||||
else if (currentlyFocusedComponent == this || isParentOf (currentlyFocusedComponent))
|
||||
else if (hasKeyboardFocus (true))
|
||||
giveAwayFocus (currentlyFocusedComponent != this);
|
||||
|
||||
if (flags.hasHeavyweightPeerFlag)
|
||||
|
|
@ -546,11 +546,12 @@ void Component::setVisible (bool shouldBeVisible)
|
|||
{
|
||||
ComponentHelpers::releaseAllCachedImageResources (*this);
|
||||
|
||||
if (currentlyFocusedComponent == this || isParentOf (currentlyFocusedComponent))
|
||||
if (hasKeyboardFocus (true))
|
||||
{
|
||||
if (parentComponent != nullptr)
|
||||
parentComponent->grabKeyboardFocus();
|
||||
else
|
||||
|
||||
if (hasKeyboardFocus (true))
|
||||
giveAwayFocus (true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue