mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-16 00:34:19 +00:00
Added some notes and an assertion to Component::grabKeyboardFocus(), to help people avoid a common mistake, which is trying to grab the focus of not-yet-visible components.
This commit is contained in:
parent
3b2014a5db
commit
e253b8bea1
3 changed files with 49 additions and 37 deletions
|
|
@ -728,7 +728,7 @@ bool ProjectContentComponent::showDocument (OpenDocumentManager::Document* doc,
|
|||
|
||||
bool opened = setEditorComponent (doc->createEditor(), doc);
|
||||
|
||||
if (opened && grabFocus)
|
||||
if (opened && grabFocus && isShowing())
|
||||
contentView->grabKeyboardFocus();
|
||||
|
||||
return opened;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue