Center text inside TextEditor [SOLVED]

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);
            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?'s only for text to show when empty...sorry :-)

1 Like