开发者

flex combobox backspace or delete key does not delete highlighted text

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 fi开发者_JAVA技巧ltered 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?


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜