How do you set text colour for DialogWindow title text?


#1

I see that DialogWindow takes a colour in the constructor, but how do I set the colour of the text for the titlebar? Naturally if I set the background color to black, I’ve got a problem :slight_smile:


#2

Solution 1: (what will be in next version, I hope, as Jules says)
Set a custom look and feel class. Override the setTextColour method.

Solution 2: (Currently working with 1.10 version)
In your dialog paint, call DialogWindow::paint(g) first, then write the following:

    g.setColour (/* Put your colour here */);
    g.setFont (titleHeight * 0.6f, true);

    g.drawFittedText (getName(),
                      10, bevelWidth,
                      getWidth() - 20 - closeButton->getWidth(), titleHeight - 2,
                      Justification::centredLeft, 2);

This will be reworked soon as Jules said, so it’s okay to use the 2 solution while waiting for the first.


#3

Cool, any idea when the next version will be out? For now the solution you gave will do the trick I guess. Thx.


#4

I’ll do a new version in a few days, but haven’t done any look-and-feel stuff for it yet - there’s a load of other stuff I want to get out there first, and I’ll do the look-and-feel changes in a version of its own.


#5