AlertWindow editor keybord issue

Posted: Fri Jul 17, 2009 10:56 am Post subject: AlertWindow editor keybord issue.
I’m using latest juce. Mac 10.5.5

with 1.46 i have wrote:

AlertWindow* rename_window = new AlertWindow(T(“Program - rename”), T(“Enter program name”), AlertWindow::NoIcon);
rename_window->addTextEditor(T(“name”), T(""), T(“Maximum 31 characters”));
rename_window->addButton(T(“Ok”), 1, KeyPress::returnKey);
rename_window->addButton(T(“Cancel”), 2, KeyPress::escapeKey);
int pressed = rename_window->runModalLoop();

Code was worked.

At current moment with updates juce, i’ll got such bugs:

Alert window in not on top(for plugin it is under plugin UI). But it can be fixed with setAlwaysOnTop(true).

Editor on alert window can’t get keyboard focus. I can past data to it, copy from it, but there is no cursor in it. And it impossible to type in it.

Thanks, Michail.

As an AU, RTAS, or VST? Which host?

AU and RTAS 100%
But i think VST too(i’ll check).

Logic Pro 7, Live, Pro Tools LE 8.0.


Have you tried calling setWantsKeyboardFocus (true) on the alertwindow?

Yes, of course. Not helps. Also, i was trying to add setWantKeyboardFocus(true) in addTextEditor, but no results…

Really? I just tried it and it worked for me.

The reason is that in top-level windows in a plugin avoid taking focus unless the actual top-level component has this flag set (regardless of whether the subcomponents inside it want focus). This is to avoid taking keystrokes away from the host unless you really want them.

It’s not a perfect solution, but I can’t really think of a better one at the moment…

Hm… I’ll try again.


I’ve just been looking at this again, and have checked in something that might help. I’ve made it a bit smarter so that hopefully only the main plugin window will avoid getting focus, and not other ones…

Ok, thanks a lot!

I’ll check today morning and answer tommorow.

Work fine!