Change text in combobox

Hello,

i have a problem with a combobox …
I use the open-event of a window to pre-populate a combobox with seven values (“Name 1”, “Name 2”, … “Name 7”).
As these values are only dummy-values the user should be able to change each one of these values to his desired name.
Later the values are stored (together with some other data) in a text file.

My question now:
How can i change one specific text-entry in the combo-box (e.g. change “Name 4” to “My new Name 4”).

Thanks very much for your hekp

Peter

It is tricky because the value of each menu option is read-only. So the workaround is to store the values of the current menu items, remove all rows starting from the selected one, then replace the selected menu item text value by the content of the text field, and then addrows from the selected menu item to the end of the menu.

This project does that in the TextChange event of a ComboBox to update the selected row with the content of what is typed in the text field.

combobox.xojo_binary_project

Hi Michael,

thanks very much for your help.
I’ll try and let you know about my success :slight_smile:

Peter