Center text inside TextEditor [SOLVED]


#1

I've noticed that my code never go inside here due to unsatisfied conditions (ex getTotalNumChars == 0:

 


void TextEditor::paintOverChildren (Graphics& g)
{
    if (textToShowWhenEmpty.isNotEmpty()
         && (! hasKeyboardFocus (false))
         && getTotalNumChars() == 0)
    {
        g.setColour (colourForTextWhenEmpty);
        g.setFont (getFont());
        if (isMultiLine())
            g.drawText (textToShowWhenEmpty, getLocalBounds(),
                        Justification::centred, true);
        else
            g.drawText (textToShowWhenEmpty,
                        leftIndent, 0, viewport->getWidth() - leftIndent, getHeight(),
                        Justification::centredLeft, true);
    }
    getLookAndFeel().drawTextEditorOutline (g, getWidth(), getHeight(), *this);
}

I can't get the text center either if I set MultiLine = true. Is it necessary checking number chars  = 0?

 

 

OOPPSSS...it's only for text to show when empty...sorry :-)