How to get Get notification of property change


#1

Hello falks,

I am workgin with propertypanel and property components, I am facing some issue and doubts i want to ask. Please help.

class TextProperty : public TextPropertyComponent
                        , public ChangeListener
{
public:
    TextProperty(  const String& name,
                        const int maxNumChars_,
                        const bool isMultiLine_,
                         EditorComponent & _editorComp) ;
    ~TextProperty();
    void changeListenerCallback (ChangeBroadcaster*);
    void setText(const String& newText);
private:
    EditorComponent & editorComp;
};
// In class definitions 
void TextProperty::setText(const String& newText)
{

// If I want to get notification that text is changed of TextPropertyComponent 
// The value what i want to set comes empty initially in textEditor of that property

}


void TextProperty::setText(const String& newText) 
{
TextPropertyComponent::setText(newText);

 // here it shows text i want to set on initialy in textEditor of that property
 // but each time i change text i do not get notification
}

//

What shall i do to get notification of property change if I inherits from defalut property provided in Juce.

Shall I inherit LabelListenr or TextEditorListener ? to get change notificaiton ?

 

Thanks & Regards...

ACN


#2
TextProperty * prop = new
TextProperty(protpertyName, valueLength, false, *this);
    prop->setText(propertyValue);
    prop->setEnabled(isEditable);

This is how I create TextProperties in EditorComponent. Any idea how can i achieve text changed callback in
TextProperty component ?

 

THanks Friend.


#3

My mistake,

I needed to implement following getText method.


String TextProperty::getText() const
{
    return propValue;
}

Now it works fine. But i wish it would be esier API, that some how provide propertyChanged method for any propertyComponent we use.