ContentComponent off center on iPhone


#1

Was nicely centered until JUCE 2.0.17… updated to 2.0.21 today and the whole thing is halfway off the screen. Any change I should be aware of?


#2

Hmm, not sure what that could be… I tarted-up the screen size methods in the Desktop class, but it should all still work. When you say “ContentComponent”, there’s actually no such class, so what exactly are you doing?


#3

This is what I’m doing in the main app window:

MainAppWindow::MainAppWindow()
    : DocumentWindow (JUCEApplication::getInstance()->getApplicationName(),
                      Colours::lightgrey,
                      DocumentWindow::allButtons)
{
    instrument = new TwoD_Instrument();
    Desktop::getInstance().setOrientationsEnabled(Desktop::rotatedClockwise | Desktop::rotatedAntiClockwise);
    Rectangle<int> Monitor=Desktop::getInstance().getMainMonitorArea();
    int width=Monitor.getWidth();
    int height=Monitor.getHeight();
    instrument->setBounds(0,0,width,height);
    setContentOwned(instrument, true);
    setVisible (true);
}

#4

Why are you setting the size of the content component? Surely better to just put the documentwindow into full-screen mode?


#5

i thought it needed a size or it blew. i’ve been using,

setContentOwned(instrument, false);

disclaimer: not tested on this case.


#6

Yes, you might be right that it needs some kind of non-zero size to keep it happy, but in the snippet he’s setting it to the size of the whole screen, without taking the window border into account, when it’d make more sense to just make the window fullscreen and let the content take whatever size it is given.


#7

Ok, thanks, works fine again… still a bit strange that my “old way” gives an unexpected result now.


#8

Well, I’d certainly have expected that code to create a window that’s too big. More surprising that it ever worked in the old version!