TextEditor::setText(txt, sendNotification) triggers callback in constructor [ NOT BUG - resolved ]


#1

i'm not sure if this is a bug?

TextEditor::setText (const String& newText, bool sendTextChangeMessage = true);

even if i set sendTextChangeMessage as false the textEditorTextChanged callback still triggered.

i track in the calling stack, ths sequence:

TextEditor::TextHolderComponent::valueChanged
TextEditor::textWasChangedByValue
TextEditor::setText

or this only occrs when the texteditor being initialized in the consturctor?

my code is very simple:

in the class MyWnd constructor:

txt.addListener(this);

txt.setText("......", false);   //and the callback triggered.

and this only happens 1 time

txt.setText("..aa...", false);   //no event!

txt.setText("...bb.", false);   //no event!

 

OS: Win7

JUCE: v3.0.8

 


#2

i just tried JUCE v3.1.0 and this problem still exists.


#3

Can you give me a lump of code that reproduces this, so I can quickly debug it?


#4

I'm so sorry Jules, that's my fault, in my constructor there is another method and it calls myTxtBox.clear(); this causes the triggering.

forgive my stupid behaviour.. even though I have read the topic "Reporting Bugs - Please read this before doing so!".