Hi,
I’m trying to create a TextEditor that is exactly the size of two numbers in my font. I made a new fillTextEditorBackground to fill the background with a solid color to verify that it was creating the size I wanted - it was… I called setIndents(0,0) to make sure there is no top and left indent.
My problem is that when I put text in the TextEditor using setText, part of the first number is cut off. For example, tedit->setText(“00”) will cut off part of the first 0 on both the top and left. It appears that the TextEditor has some padding built into the right and bottom that I can’t figure out how to get rid of. If I make the TextEditor larger by a few pixels in both width and height none of the numbers are cut off.
Here is my code to create the texteditor:
textWidth = MyFonts::getPrimaryFont().getStringWidth("00");
m_timeField = new TextEditor("time-field");
m_timeField->setIndents(0,0);
m_timeField->setInputRestrictions(2, "0123456789");
m_timeField->setMultiLine(false);
m_timeField->setReturnKeyStartsNewLine(false);
m_timeField->setReadOnly(false);
m_timeField->setScrollbarsShown(false);
m_timeField->setCaretVisible(false);
m_timeField->setPopupMenuEnabled(false);
m_timeField->setFont(MyFonts::getPrimaryFont());
m_timeField->setText("00");
m_timeField->setBorder(BorderSize(0,0,0,0));
m_timeField->setBounds(x, y, textWidth, (int)MyFonts::getPrimaryFont().getHeight()-(int)MyFonts::getPrimaryFont().getDescent());
this->addAndMakeVisible(m_timeField);
Any thoughts?