Browse Source

Added a styleChanged flag to enable setText() to take effect after setColor()

tags/2021-05-28
luigisambuy 9 years ago
parent
commit
ed0c032a01
2 changed files with 6 additions and 1 deletions
  1. +5
    -1
      modules/juce_gui_basics/widgets/juce_TextEditor.cpp
  2. +1
    -0
      modules/juce_gui_basics/widgets/juce_TextEditor.h

+ 5
- 1
modules/juce_gui_basics/widgets/juce_TextEditor.cpp View File

@@ -915,6 +915,7 @@ TextEditor::TextEditor (const String& name,
menuActive (false),
valueTextNeedsUpdating (false),
consumeEscAndReturnKeys (true),
styleChanged (false),
leftIndent (4),
topIndent (4),
lastTransactionTime (0),
@@ -1080,6 +1081,7 @@ void TextEditor::colourChanged()
{
setOpaque (findColour (backgroundColourId).isOpaque());
repaint();
styleChanged = true;
}
void TextEditor::lookAndFeelChanged()
@@ -1186,7 +1188,7 @@ void TextEditor::setText (const String& newText,
{
const int newLength = newText.length();
if (newLength != getTotalNumChars() || getText() != newText)
if (newLength != getTotalNumChars() || getText() != newText || styleChanged)
{
textValue = newText;
@@ -1212,6 +1214,8 @@ void TextEditor::setText (const String& newText,
scrollToMakeSureCursorIsVisible();
undoManager.clearUndoHistory();
styleChanged = false;
repaint();
}
}


+ 1
- 0
modules/juce_gui_basics/widgets/juce_TextEditor.h View File

@@ -684,6 +684,7 @@ private:
bool menuActive;
bool valueTextNeedsUpdating;
bool consumeEscAndReturnKeys;
bool styleChanged;
UndoManager undoManager;
ScopedPointer<CaretComponent> caret;


Loading…
Cancel
Save