FileChooser and Keyboard Focus


#1

After opening and closing a FileChooser my app loses keyboard focus, and the only way to get it back is by clicking somewhere in the app with the mouse. This is annoying because no KeyPresses work until the app is refocused. Here's my code:

 

FileChooser myChooser ("Select Midi File...", defaultDir);
 
if (myChooser.browseForFileToOpen())
{
     // do a bunch of crap with the file...
}

grabKeyboardFocus();

 

The grabKeyboardfocus at the end doesn't seem to help. Mac OS 10.7, Juce 3.0. Any ideas?


#2

Were you ever able to figure out a solution to this?


#3

In my Standalone plug-in when I close the FileChooser, I have to use

 ...->getParentComponent()->toFront (true);

to set the focus back to my app. Are you just losing keyboard focus, or complete focus?

Rail


#4

Seems like complete focus. Just trying to get my buttons hoverable within my component without having to click after closing File Chooser. The above did not work :frowning:


#5
getTopLevelComponent()->toFront(true); worked in my case! Simple.