I am just starting out with Juce and am having trouble. Doxygen gives a log of info but sometimes not enough for me and I have not been able to find examples of what I want to do. (This is windows and my only windows experience is with MFC).

I started with the “Hello World” example code. I was able to add sliders, button, text, etc to the box and capture the expected inputs. But now I want click a button that opens a dialog box with sliders and buttons on it.

I assume trying to use DialogWindow to do this. First I created and new class derived from DialogWindow. In the constructor I add the controls. Then in MainComponent::buttonClicked, I do the following:

MyDlg *y = new ChannelDlg(x, Colour(0xffeedd), true);

This renders a dialog box that is transparent and has no controls. Since doxygen says do not use showDialog I tried to use launchOptions with no success either.

Is there any sample code or tutorial that creates a modeless dialog box started from another dialog and uses the launchOptions?. (I case I have a different understanding of modeless what I mean is the original window that opened the dialog box is still responsive and can take input.



I always use the static method of the DialogWindow class. First create the component i want to show then just add it as the content of the dialog.

class MyComponent : public Component
MyComponent comp;
DialogWindow::showModalDialog ("Title", &comp, nullptr, Colours::white, true, false, false);

and that seems to work for me.


Have a look in the JUCE demo project, search for “DialogWindow::LaunchOptions” and you’ll see the colour selector demo is shown in this way.

If you don’t wan’t your window to be modal however I think you just have to call LaunchOptions::create() and then setVisible. Using the same example: [code] DialogWindow::LaunchOptions o;

        o.content.setOwned (new ColourSelector());
        o.content->setSize (400, 400);

        o.dialogTitle                   = "Colour Selector Demo";
        o.dialogBackgroundColour        = Colours::grey;
        o.escapeKeyTriggersCloseButton  = true;
        o.useNativeTitleBar             = false;
        o.resizable                     = true;

        o.create()->setVisible (true);


You’ll have to make sure you close the window before shutting down your app though or you’ll hit assertions.


Thanks for the replies.
I got it to work.