DialogWindow not visible

I’m trying to display a dialog. I’m not using DialogWindow::showModalDialog() because I want to use it not modally.

The dialog constructor:

SimulationDlg::SimulationDlg()
	: DialogWindow(T("Simulation"), Colours::lavender, false, false)
{
	setBounds(0, 0, 400, 600);
		
	mainComponent = new Component();

	goBtn = new TextButton(T("GO!"));
	quitBtn = new TextButton(T("Quit"));
	logEdit = new TextEditor();

	mainComponent->setBounds(1, 1, 399, 599);
	mainComponent->addAndMakeVisible(goBtn);
	mainComponent->addAndMakeVisible(quitBtn);
	mainComponent->addAndMakeVisible(logEdit);

	goBtn->setBounds(5, 5, 60, 20);
	quitBtn->setBounds(100, 5, 60, 20);
	logEdit->setBounds(5, 100, 300, 200);
	logEdit->setMultiLine(true);

	setContentComponent(mainComponent, true, true);
	mainComponent->setVisible(true);
}

For now I’m trying to show it with:

SimulationDlg dlg;
dlg.setVisible(true);
dlg.toFront(true);
dlg.runModalLoop();

The dialog doesn’t becomes visible. The modal state is entered because I can’t click anything in the main window but the dialog remains invisible. I can’t understand what is wrong or missing…

You’re passing “false” as the “add to desktop” parameter of the DialogWindow constructor, so it’s not actually getting put in a window.

(hmm - I might add an assertion if you try to run an non-visible component in a modal loop)