Start app maximized?

Hi all,

Quick and simple question, can’t find it in the docs nor with a forum search.

I’m running my app with the native win32 windowframe.
How do i start my juce app maximized ?

Radiance

Hi,
I haven’t tried it myself but you can give it a try. If your main window is a juce window, You can do this in your main window class.

getMaximiseButton()->setToggleState(true,true);

…doesn’t setFullScreen (true) do the trick?

(I wouldn’t recommend trying to use the button state to trigger it - it might work but is a bit hacky)

Hi Jules,
What about the maximize button state? Will that change to ON if setFullScreen (true) is used. I thought of using setFullScreen, but decided against doing it because I was worried about the button state.

The buttons will follow the window’s state - if they don’t then that’d be a bug! The window could be maximised by other means than clicking the button, so they need to respond to that.

Besides, if you use a native titlebar, there are no buttons that you can use like this.

Oh okay.:oops:
Thanks Jules.

so is it possible with a native titlebar or not ?

Thnx,
Radiance

Like I said: “setFullscreen (true)”. Or are you saying that this isn’t working properly?

“setFullscreen (true)” should work. I have used “setMinimised(true)”, which minimizes the window, so there shouldn’t be any problems with “setFullscreen”.

Like I said: “setFullscreen (true)”. Or are you saying that this isn’t working properly?[/quote]

yup, problem solved :slight_smile:

I was a bit confused by the discussion regarding the use of the juce window buttons…

Thnx!,
Radiance

I apologize it’s all my fault. May be “I Can’t think straight” :frowning:

As I am a noob I might be doing something wrong, but it appears setFullScreen is not available for an animated application. At least not when I start a new Animated Application from within Projucer, and replace the maincomponent.cpp, mainComponent "setSize (800, 600); with setFullScreen (true); Says it is “undefined”.

I can get the screen resolution this way though;
Rectangle<int> area = Desktop::getInstance().getDisplays().getMainDisplay().userArea;

But if I then setSize to those coordinates, the application title bar and border line is gone.

Or even simpler I can set the size to the screen resolution this way;

setSize(getParentWidth(), getParentHeight());

But again that sets my app size so big, that there is no title bar or border lines around the app.

The thing is, setFullscreen() is a method of ResizeableWindow…

When I want the whole screen filled without setting the fullscreen flag, this does the job for me (in MainComponent):

    const auto area = Desktop::getInstance().getDisplays().getMainDisplay().userArea;
    setBounds (area);

Although, when I have a secondary monitor, I see an offset of a half top bar… a bit weird…