Component::handleMessage


#1

Is there any particular reason why Component::handleMessage is declared private? It would be convenient if I could have implement this in my own components.

Matt


#2

Never mind - I just worked around it by implementing a custom MessageListener. Still seems clumsier than it needs to be.

Basically, I just want to update my UI with messages from another thread. Maybe I’m missing a straightforward way to do that.

Matt


#3

The main reason is just to stop people overriding it and failing to call the superclass in their implementation, as Component relies on sending itself messages for everything to work properly. I guess I could make it protected…

If all you don’t need to attach data to your message, you could use Component::postCommandMessage() and handleCommandMessage(), or I often use an AsyncUpdater for that kind of thing.


#4

In this case, I was sending text strings from a thread and showing them on the screen in a TextEditor. So Messages work nicely since I can pass the String in the pointer parameter and then delete it.

Please don’t bother changing anything - I’m just being grouchy.

Matt


#5