First I just want to say thanks for all your work on this library. I tried wx, qt, fltk and had trouble getting them to even compile on my computer (I’m running OSX 10.6), where as I downloaded JUCE and boom! worked first time.
Basically, all I’m trying to do is start up a window containing an OpenGLComponent that I can draw to and grab mouse and keyboard events from, nothing complex at all.
The first problem, is that if I call setUsingNativeTitleBar(true), then i get an ‘invalid drawable’ message that appears to be being generated from inside NSWindow makeKeyAndOrderFront:. If I omit the native title bar call, everything continues happily and I can make open GL calls with no problems.
The second problem seems related, but when I run the application, it doesn’t appear as the front or active window, rather it appears behind whatever I ran the program from (terminal, finder, xcode, whatever). In addition, it never seems to gain keyboard focus, it receives mouse events without issue, but keyPressed() never gets triggered.
Strangely, when I run the Hello World demo app by linking against the libraries built with the supplied xcode project, rather than using the amalgamated files, I get the same focus and keyboard issues. Is it possible that the amalgamated version differs from the non-amalgamated version?
This is the relevant code, hopefully there is something obvious I have missed (I am running JUCE v1.51.16):
void juce_application::initialise(const String& commandLine)
{
//create the main window and open gl context
String title = getApplicationName() + " - " + getApplicationVersion();
m_main_window = new main_window(title, 640, 480);
m_main_window->setVisible(true);
}
main_window::main_window(const String& name, int width, int height) :
DocumentWindow(name, Colours::whitesmoke, allButtons, true)
{
//setUsingNativeTitleBar(true);
setWantsKeyboardFocus(true);
centreWithSize(width, height);
setContentComponent(new main_component(width, height), true, true);
}
main_component::main_component(int width, int height)
{
setSize(width, height);
}
Any help would be much appreciated.