Hi, I feel a little bit bad for asking so many questions… But believe me, I always do a search in the previous posts. Once again I didn’t find anything. So here it is…
I have a ComboBox with a set of Items. I want to be able to add, delete and rename items. In order to do that, I set the ComboBox editable and display three buttons next to it: add,delete,rename.
Here’s my current solution with its weird things… I wonder if it can be done in an easier way. I don’t understand why JUCE doesn’t make it easy (it always does it, right? :). I guess I didn’t find again the proper way to do it.
ADD:
addItem(value,id) does the job.
However the selected id of the combobox is set to 0 so I have to write
an additional setSelectedId(numberOfItems). For me it would make sense that the selected id is kept constant or that it is set automatically to the id of the added item. What do you think?
DELETE:
I didn’t find any method to delete an item. So I basically used clear() and
added all the resulting items (stored elsewhere), again using the previous procedure. Did I miss the right method to do it?
RENAME:
changeItemText(id,value) does the job.
This method turns the selected id into 0 if the item changed was the one it was displayed. So I have to write an additional setSelectedId(numberOfItems) too, however here I have to add a condition: only if the item displayed is the one we are renaming. I’d rather expect the selected id to keep constant in all cases and refresh automatically the name of the combobox (now I have to do it)…
Let me know… Once again, thanks for reading…