0
votes

Context:
I am implementing a flex auto-suggest combobox - as the user types in each character: Consider the string 'Stackoverflow' and user input = 'st'

1) the data provider is filtered to show all items starting with 'st' 2) text is set to auto-suggest string such that the un-typed part is highlighted.

So for instance, the combobox text may contain st'ackoverflow', where 'ackoverflow' is highlighted using setSelectedIndex()

Issue:
When I hit back-space or delete, and check the 'this.text' value, I expect that the last un-highlighted character ('t' in the above case) gets deleted and the data provider is filtered to show all items starting with 's'. However the text property contains 'st', as before

Question:
what am I missing? What else can I try out?

2

2 Answers

0
votes

I realized that my assumption was incorrect - when I hit backspace, the highlighted portion of the text alone should go away - I need to do some extra processing to get one extra character at the beginning to go away

0
votes

Here is how this was implemented: Listen to the backspace key event and set a Boolean flag. Then in the List change handler, read the boolean flag and set the this.text to what you want (i.e.) with 1 char deleted beyond the beginning of the highlight. Note that you cannot immediately set the this.text in the backspace handler because the textinput control backspace handler will reset what we set.