Small consistency problem


#1

Okay, I know this is a trivial issue, but nearly wasted a week of my life :slight_smile:

Most components such as the Button variants and Slider Classes all offer primary value setters looking like this:

void Button::setToggleState (const bool shouldBeOn, const bool sendChangeNotification)

…which is perfectly fine.

However, the ComboBox class has a different signature:

void setSelectedItemIndex (int newItemIndex, bool dontSendChangeMessage = false);

In action, it is super easy to confuse both options and create evil endless loops in certain cases (especially when using JUCEs audio plugin example project’s UI update approach ;D ).

I’m well aware that this isn’t easy to fix without breaking old code. But it would be great to make these flags more consistent in a potential future update… :wink:


#2

Thanks. I’ve already started replacing some other similar code to this (see the NotificationType enum), just hadn’t got as far as that particular class yet.


#3

To not send out notifications, we currently have:

button->setToggleState(true, false);
combo->setSelectedId(true, true);
slider->setValue(true, dontSendNotification);

That’s not a “small” inconsistency anymore, that’s bordering on obfuscation. :slight_smile: