The Combobox


#1

Can someone tell me why comboboxes are actionlisteners instead of change listeners. Or more specifically, why the callback sends the component name in a string instead of a pointer.

Seems like a awkward way to go about it if you ask me.

Whats the simplest way of getting a combobox to act like a change broadcaster?


#2

Good question, and it’s one of the things I might take a look at soon with an eye to refactoring it. Easy enough to catch the actionlistener callback and trigger a changebroadcaster if that’s what you need to do though.


#3

Ok, fair enough.

( I was thinking more along the lines of subclassing the combobox and making it changebroadcaster.

But for the time being, I’ll just go like so:

void actionListenerCallback (const String &message){
    for(int i = 0; i < 19; i++){
        if (message == comboBoxArray[i]->getName()){
            changeListenerCallback(comboBoxArray[i]);
            return;
        }
    }
}

It’s a bit redundant, for sure, but it makes things simpler to have it all in the changelistener function. )


#4