Label is not updating outside the constructor

I’m trying to update the value of the label outside the constructor in the setMessageNew method, but its not updating, i don’t know why this happen.


Created: 18 Oct 2020 9:55:24pm
Author:  RGG

#include <JuceHeader.h>
#include “MessageControl.h”

MessageControl::MessageControl(T1AudioProcessor& p) :
messageControlLabel.setText(“messageControlLabel”, juce::dontSendNotification);
messageControlLabel.setColour (juce::label::textColourId, juce::Colours::black);


//intLabel = nullptr;
//void MessageControl::tooltipReciever(Slider& temp, String value){
// temp.setTooltip(value);
void MessageControl::setMessage(String value){
// text = value;
//messageControlLabel.setText(“string”, juce::dontSendNotification);
std::cout<< “MENSAJE EN CONSTRUCTOR” << value << std::endl;

void MessageControl::paint (Graphics& g)

void MessageControl::resized()
messageControlLabel.setBounds(50, 20, 40, 35);
//toolTip.setBounds(400, 20, 20, 20);

void MessageControl::setMessageNew(String value){
messageControlLabel.setText(“SECOND”, juce::dontSendNotification);
messageControlLabel.setText(value, sendNotification);
DBG(“String text through DBG” << value);

void MessageControl::labelTextChanged(juce::Label* label){
if (label == &messageControlLabel){
std::cout<<“LABEL TEXT CHANGED”<<std::endl;
messageControlLabel.setText(messageControlLabel.getText(), sendNotification);

I don’t understand what are you trying to do? What exactly should be changing the label text and when? Is some other code than what you showed calling the setMessageNew method?

Im creating an instance of the class messageControl in another class, and then i call the method setMessageNew and pass the value of a slider. The string is passed by a slider listener and when i print the value trough the terminal i see the correct value but the label does not update

Try using “dontSendNotification” for all the Label setText calls. And why do you have the “labelTextChanged” handler in the code? Your code is way too complicated for what you are trying to achieve.

OT: to make your code more readable, please indent every line with 4 spaces, or surround the whole code with three backticks before and after, like this:

void your_code_here ()

The same is obtained by selecting the code in your post while editing, then pressing the button that has this symbol on it: </>