Browse Source

Ensure that keyboard focus is always given away when components are made invisible

tags/2021-05-28
ed 5 years ago
parent
commit
33dd896ab2
1 changed files with 4 additions and 3 deletions
  1. +4
    -3
      modules/juce_gui_basics/components/juce_Component.cpp

+ 4
- 3
modules/juce_gui_basics/components/juce_Component.cpp View File

@@ -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…
Cancel
Save