Easiest way to pop a dialog box with a ColourSelector?

What’s the easiest way to pop a dialog box that contains, as its content component, a ColourSelector with OK and Cancel buttons that call Component::exitModalState with the appropriate value (the colour will be transmitted using the ModalComponentManager::Callback)?

Is there a general solution or do I have to roll a DocumentWindow-derived class every time?

DialogWindow::showModalDialog() used to work for me, but what i’m seeing now, Dialog windows are not in style.

Yeah but I still have to roll my own DocumentWindow…is there no easier way to use the ColourSelector??

And then how do I get the Colour? By the time the modal state ends, the dialog box is destroyed and the only thing I get back is an int.

Have you tried the pop-up colour selector in the introjucer’s colour editing panel? It uses a CalloutBox.

void xxxxx()
{   
    ColourSelector colourSelector;
        
    colourSelector.set... (...);
    colourSelector.addChangeListener (...);
   
    CallOutBox callOut (colourSelector, *this, nullptr);
    callOut.runModalLoop();
}

void changeListenerCallback (ChangeBroadcaster* source) 
{
    ColourSelector* cs = dynamic_cast <ColourSelector*> (source);
    setColour (SomeComponentClass::xxxColourId, cs->getCurrentColour());
    //...
}

Just in case anyone else finds this link, correct calling is noted here: