FR: Option to allow ComboBox to reselect the same item

Presently, it is impossible to reselect the same item from a ComboBox - it is filtered out.

However, this can be a useful expected behavior, as in the case of reselecting a preset in order to blow out any edits. This has been discussed in multiple threads here.

Therefore, it seems it would be really easy to add this as an option. It’s basically a one line edit to the .cpp file and the inclusion of a bool variable.

Something like this:

ComboBox.h:

public:
	void setCanReselectSameItem(const bool state) { canReselectSameItem = state; }

private;
    bool canReselectSameItem = false;

ComboBox.cpp:

void ComboBox::setSelectedId (const int newItemId, const NotificationType notification)
{
    auto* item = getItemForId (newItemId);
    auto newItemText = item != nullptr ? item->text : String();
    
    //if (lastCurrentId != newItemId || label->getText() != newItemText)
    if (canReselectSameItem || (lastCurrentId != newItemId || label->getText() != newItemText))
    {
        label->setText (newItemText, dontSendNotification);
        lastCurrentId = newItemId;
        currentId = newItemId;

        repaint();  // for the benefit of the 'none selected' text

        sendChange (notification);
    }
}

Discussions:

I already used my two votes, but we would definitely like this, as well!

1 Like

OT, but afaik you should have 5 votes…?

Check on your User-Icon -> Activity -> votes

1 Like

Also OT, but related: at what point do we give up hope on requests that are using votes?

Most of mine are on requests that are 2 years old now.

I wish there was a public roadmap to see what the team is working on/will be tackling next, it could even just be a pinned topic with comments disabled that they update periodically.

2 Likes

These kind of questions are considered lèse-majesty and ignored generously instead of incarceration :wink:

1 Like