Label feature request


#1

I have a Label derived component, and i need to perform external stuff in setText but it is not virtual, and adding my external stuff in a LabelListener still makes it possible to not call that piece of code if i pass false as broadcastChangeMessage in setText.

Could be added a virtual method in the Label:

virtual void textWasChanged ();

called independently in setText:

void Label::setText (const String& newText,
                     const bool broadcastChangeMessage)
{
    hideEditor (true);

    if (text != newText)
    {
        text = newText;

        textWasChanged ();

        if (broadcastChangeMessage)
            triggerAsyncUpdate();

        repaint();

        if (ownerComponent != 0 && ! deletionWatcher->hasBeenDeleted())
            componentMovedOrResized (*ownerComponent, true, true);
    }
}

is a sensible request ?


#2

Sounds pretty sensible - but why not just use a LabelListener to respond to the text change?


#3

cause i want to update those internal bits before the paint method even when i change the text and i do not want to notify my listeners.


#4

Sorry, you did explain that in the original post, but I obviously wasn’t paying attention…

Ok, it’s a simple addition, and might come in handy, I’ll throw it in there.