Is there a way to make Autocomplete update the case of the entered text?
Let’s say I’m typing “blu” and “blue Moon” pops in as the autocomplete result. “Blue Moon” is the source of the Autocomplete. If I just accept the text, I don’t get the capitalized “Blue”.
Do I have to search through my source array to find the correct result or is there a parameter I’m missing?
I’m sorry if this is too silly/trivial to bring up as a topic.
You could probably use the case insensitivity of a Xojo string comparison to your advantage.
In all of the locations a change event is implemented (for ComboBox it varies between Mac and Windows)
var iTargetIndex as Integer = arsMyValues.IndexOf(me.Text)
if iTargetIndex > -1 then
// Set the exact value that's in the array so that the desired casing is applied
me.Text = arsMyValues(iTargetIndex)
end
The framework is usually pretty good at preventing infinite loops caused by events like this, but you may wish to add your own protection against that.
1 Like
Thanks, Tim. Is this some kind of magic? Does IndexOf search the entire array? I still have to loop through my array, right?
OK, I found it (IndexOf) as an array method. I don’t know how I missed that, or maybe it was recently added? Anyway, this makes it easy. Thanks for the solution.