I have a Combobox which needs to be repopulated dinamically, that is, the user type 3 characters in the ComboBox and press the return key. In this moment a query is executed and the Combobox needs to be populated with the items resulted by that query. The problem that I found is that the ComboBox.Items.Clear doesn't have the expected effect.
Here is a simple example:
Add a TUniComboBox
On the OnKeyDown method, add the code:
if Key=VK_RETURN then
UniComboBox1.Items.Add('RIO DE JANEIRO');
UniComboBox1.Items.Add('RIO GRANDE DO SUL');
UniComboBox1.Items.Add('RIO GRANDE DO NORTE');
Run the program
Inside the ComboBox, type "RIO" and press the return key: it will appear 3 items at the ComboBox
Edit the typed text to "RIOS" and press the return key again
In this moment I expected that the Combobox was cleared and populated with the 3 options, but the result obtained is that the ComboBox has 6 items, as if the "UniComboBox1.Items.Clear" instruction had been ignored.
Thanks in advance!