Interest in a combobox designed for adding/removing options

I was working on a project recently where I wanted to add/remove options from a combobox. It turns out that this is surprisingly difficult to do, with the only technique I could find for doing so (cloning all the options and creating a new state for the combobox) being really clunky and inefficient, in response I made a PR ( Combobox enhancement: add `add_option` and `extract_options` functions to allow easier addition/removal of options by Adam-Ladd · Pull Request #2684 · iced-rs/iced · GitHub ) which adds some functions (add_option and extract options) for combobox which improve this somewhat. However, I couldn’t implement some features I’d like, such as checking if an option is already present when inserting an option, as the only trait requirements on the options in a combobox are:

T: Display + Clone

This also meant that I couldn’t create a function to remove an option as the lack of PartialEq means I can’t check for equality (it might be possible to find an index by checking against the option_matchers but I’m not sure if this can be guaranteed to give the correct results).

Therefore, I am considering developing a new widget (either for a PR to iced or as it’s own crate) based on the combobox but which is designed for easy addition/removal of options.

Please let me know if you would be interested in this widget and if so what functionality you would like

Thanks,

1 Like

I haven’t used combo_box extensively but I’m all for extending the built-in widgets with more advanced features that may be too niche to warrant inclusion directly in the library.

So much so that I’ve created a crate for that specific purpose:

It’s mean to be open and welcoming to contributors, so if you’d like to put up your modified combo_box there, that would be awesome.

Right now it only has a modified mouse_area which returns the cursor position when clicked and a modified pick_list with optional disabling of elements, but I have a few other ideas of my own in the works and one potential slider improvement that allows for multiple handles in a single slider (which was written by someone else!)