5.4.4 breaks ComboBoxes with SectionHeadings and Attachment

If a SectionHeading is added to a ComboBox via addSectionHeading ("Heading"); and the ComboBox is used with a ComboBoxAttachment, the chosen choices are off by 1, as a parameter value of 0 will select the heading, and not the first item after the heading.

The behavior was different with 5.4.3, worked like a charm.

I use the section heading for some parameters, where my GUI won’t allow to add the description of the choices next to the ComboBox, like here:
57

The heading “Number of channels” is select, as the parameter has a default value of 0.

From the docs: The headings are indented slightly differently to set them apart from the items on the list, and obviously can't be selected. <- the last part is not true any more :wink:

2 Likes

So after some digging I found this change:


Especially this line:
PopupMenu::Item::Item (String t) : text (std::move (t)), itemID (-1) {}
This constructor sets the itemID for headings to -1, which in general is just fine.

However, this collides with:

which is eventually called in the initialUpdate() call of the ComboBoxAttachment.
So it counts the heading as an element.

Maybe this one should be changed to
if (item.itemID > 0)
otherwise also headings can be selected by calls of setSelectedItemIndex

1 Like

Created a PIP which demonstrates the issue:

ComboBoxHeadingSectionsAttachment.h (3.2 KB)

Also notice the strange behavior of the parameter values (via DBG), there are also sometimes jumps (selecting 1, jumps to 2).

1 Like

Thank you for the detailed report and example, this should now be fixed in 319efc5.

Works like a charm, thanks!
Any chances for a cherry pick? :slight_smile:

Sure, will do that now.