Remove title bar from main window


Hi, how would it be possible to remove the title bar from the main application window?



I was looking for the answer myself.
Searched through all methods there, found nothing.
HOWEVER, managed to get a workaround going which does the job flawlessly.
in Main.cpp file’s constructor, set these:

        setUsingNativeTitleBar (false);

setting Height with native title bar does nothing, but with that turned off and height 0 it hides it completely.

Another way to do it, maybe less hacky, is not to instanciate a DocumentWindow component but a simple Component instead, and call addToDesktop to it.

The default class MainWindow in main.cpp inherit from DocumentWindow. First we need to remove this inheritance, and instanciate the MainContentComponent as a root component.

class MainWindow
    MainWindow (String name)
        mMainCompotnent = createMainContentComponent();
        mMainCompotnent->setVisible (true);
        mMainCompotnent->addToDesktop (ComponentPeer::windowHasDropShadow);

        delete mMainCompotnent;
    Component * mMainCompotnent;
1 Like

wizard! there is one issue with both methods though, the window can’t be dragged. Can’t find a solution as of yet… Probably a method already exists for something like this, else it could be “hacked” with mouseDrag events, im sure. New to JUCE I am :confused:

You can use ComponentDragger to implement dragging. Using some conditions within mouseDown/mouseDrag (e.g. “if (e.getMouseDownY() < 20)”) you can also make dragging available within a given area instead of the whole component.

works like magic! thx :slight_smile: