diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp index 71a0ae94a..637716501 100644 --- a/src/gui/widget/textbox.cpp +++ b/src/gui/widget/textbox.cpp @@ -178,6 +178,7 @@ void CTextBox::initVar(void) m_textBackgroundColor = m_old_textBackgroundColor = COL_MENUCONTENT_PLUS_0; m_textColor = COL_MENUCONTENT_TEXT; + m_old_textColor = 0; m_nPaintBackground = true; m_nBgRadius = m_old_nBgRadius = 0; m_nBgRadiusType = m_old_nBgRadiusType = CORNER_ALL; @@ -517,6 +518,7 @@ bool CTextBox::hasChanged(int* x, int* y, int* dx, int* dy) || m_old_dx != *dx || m_old_dy != *dy || m_old_textBackgroundColor != m_textBackgroundColor + || m_old_textColor != m_textColor || m_old_nBgRadius != m_nBgRadius || m_old_nBgRadiusType != m_nBgRadiusType || m_old_nMode != m_nMode){ @@ -531,6 +533,7 @@ void CTextBox::reInitToCompareVar(int* x, int* y, int* dx, int* dy) m_old_dx = *dx; m_old_dy = *dy; m_old_textBackgroundColor = m_textBackgroundColor; + m_old_textColor = m_textColor; m_old_nBgRadius = m_nBgRadius; m_old_nBgRadiusType = m_nBgRadiusType; m_old_nMode = m_nMode; @@ -699,12 +702,14 @@ void CTextBox::refresh(void) } -bool CTextBox::setText(const std::string* newText, int max_width) +bool CTextBox::setText(const std::string* newText, int max_width, bool force_repaint) { //TRACE("[CTextBox]->SetText \r\n"); bool result = false; m_nMaxTextWidth = max_width; - + //reset text to force repaint the text, managed in hasChanged() + if (force_repaint) + m_old_cText = ""; //printf("setText: _max_width %d max_width %d\n", _max_width, max_width); if (newText != NULL) { diff --git a/src/gui/widget/textbox.h b/src/gui/widget/textbox.h index 044c82b55..0922521c8 100644 --- a/src/gui/widget/textbox.h +++ b/src/gui/widget/textbox.h @@ -124,7 +124,7 @@ class CTextBox int m_old_x, m_old_y, m_old_dx, m_old_dy, m_old_nBgRadius, m_old_nBgRadiusType, m_old_nMode; bool m_has_scrolled; - fb_pixel_t m_old_textBackgroundColor; + fb_pixel_t m_old_textBackgroundColor, m_old_textColor; bool m_showTextFrame; @@ -183,7 +183,7 @@ class CTextBox void scrollPageDown(const int pages); void scrollPageUp(const int pages); void enableBackgroundPaint(bool mode = true){m_nPaintBackground = mode;}; - bool setText(const std::string* newText, int max_width = 0); + bool setText(const std::string* newText, int max_width = 0, bool force_repaint = true); void setTextColor(fb_pixel_t color_text){ m_textColor = color_text;}; void setBackGroundRadius(const int radius, const int type = CORNER_ALL){m_nBgRadius = radius; m_nBgRadiusType = type;}; void setTextBorderWidth(int Hborder, int Vborder);