mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
FileChooser: Find an appropriate peer to focus when the FileChooser is destroyed
This works around a rare issue in the DialogsDemo where the AlertWindow would fail to display because no peer had focus.
This commit is contained in:
parent
038d6dff32
commit
0cec50618d
1 changed files with 10 additions and 0 deletions
|
|
@ -131,6 +131,16 @@ public:
|
|||
~Native() override
|
||||
{
|
||||
exitModalState (0);
|
||||
|
||||
// Our old peer may not have received a becomeFirstResponder call at this point,
|
||||
// so the static currentlyFocusedPeer may be null.
|
||||
// We'll try to find an appropriate peer to focus.
|
||||
|
||||
for (auto i = 0; i < ComponentPeer::getNumPeers(); ++i)
|
||||
if (auto* p = ComponentPeer::getPeer (i))
|
||||
if (p != getPeer())
|
||||
if (auto* view = (UIView*) p->getNativeHandle())
|
||||
[view becomeFirstResponder];
|
||||
}
|
||||
|
||||
void launch() override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue