11-28-2008 06:08 AM
I want to create a text field with autocomplete feature. This feature is not "word prediction" but rather "suggests" names and addresses from the BB contacts. I know how to retrieve this information but implementing the "autocomplete" is the issue here.
Is there any support in the API for this? Or would I have to create a complete custom component?
11-28-2008 07:43 AM
12-01-2008 03:04 AM
12-01-2008 05:02 AM
Guest - What you are suggesting (using keyDown) seems to work for the first character, but after that you seem to loose control. The sort of autocomplete I was trying to implement, required more than one character before the pattern matching was accurate enough to present a useful list to the User. How do you suppress the standard autocomplete?
xoheb - the solution I was working towards was pretty much what Guest suggested. I would take the input string, then, if it matched sufficiently few of the possible options, I would supply the matched options in a pop-up that the user could choose from. Not particularly elegant, and as noted, did not work for Suretype devices. But it will work for the device types you are targeting. I used keyChar.
12-01-2008 05:20 AM
Thanks for that Peter and Guest.
One more thing though... I need to make it look like autocomplete on a web browser for example... the suggestions appearing under the text field used for user input. I wonder how I can achieve that!
From what you're suggesting, I guess the results will be shown in a new popup window, right?
12-01-2008 06:08 AM
no.I m right.I think,u couldn't understand it.This will not be created problem.Because,there will be a string,which will be by default nothing and,when he will be began to type ant character,this will be added to this string.and with this pattern it will be searched.And when backspace or dell will be,then string will be reduced naturally and at some point,the string will be nothing.
And with theresult string u have to create popup screen and have to implement listfield.
12-01-2008 06:27 AM
xoheb - I am sure there are other options, but I did the pop-up screen. I'm sure there are other options, for example, I suspect you could extend ListField to provide an input area and then populate the drop down.
Guest - I've just tested on standard 4.2 (Pearl) and 4.7 (Storm) and in both cases, once the Suretype processing has decided you are trying to type a word in, you have to 'escape' that processing to get keyDown to work again. So the problem is not getting the String out of the input Field, the problem is getting control in a nice way. keyChar and keyDown get control after every key press on the Qwerty devices, but on the Suretype input Fields, in my testing anyway, once the Suretype processing has grabbed control and is displaying its 'options', keyChar/keyDown will not get control until the user leaves this.