Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
geeneeus
Posts: 80
Registered: ‎09-12-2009
My Device: Bold 9700
Accepted Solution

Help! How to make a suggestive AutoTextEditField?

Hi everyone! I've been teaching myself Blackberry Development for the past few months and am getting pretty good at it..

 

Although I still need assistance with a few things here and there..

 

I'm wanting to make an AutoTextEditField that suggests to the user items they've entered before, for example

 

'Str' would suggest 'String' to a user with the 'ing' part highlighted or automatically display as a drop down box with suggestions...

Is there an easy way to do this, if so do you have any example code I can follow?

 

If all else fails am sure I can write my own methods to do this but would prefer to find out if there is an easier, built in way to do this to save myself some trouble and time in coding..

Genius Development Scotland
Website: http://www.genius-dev.co.uk
Developer
peter_strange
Posts: 19,609
Registered: ‎07-14-2008
My Device: Not Specified

Re: Help! How to make a suggestive AutoTextEditField?

There is no autocomplete Field that I am aware off.  Sorry you are going to have to write your own.  Can I suggest when you do, that you avoid the use of keyDown and similar methods, and in stead use FieldChanged.  The keyDown approach does not work very well on Storm or SureType devices (Pearl and 8220)
Developer
geeneeus
Posts: 80
Registered: ‎09-12-2009
My Device: Bold 9700

Re: Help! How to make a suggestive AutoTextEditField?

Made my own "AutoCompleteEditField" that will replace words with keys words from a given list.

 

Very simplistic BUT it works just the way I want and need. 

Genius Development Scotland
Website: http://www.genius-dev.co.uk
Developer
peter_strange
Posts: 19,609
Registered: ‎07-14-2008
My Device: Not Specified

Re: Help! How to make a suggestive AutoTextEditField?

Well done!

 

Any 'tips' for anyone else trying the same thing? 

 

Just being nosy, does it work on Pearl, Storm and full QWERTY device types?  I found the reduced keyboard devices to be difficult.

 

Cheers

Developer
geeneeus
Posts: 80
Registered: ‎09-12-2009
My Device: Bold 9700

Re: Help! How to make a suggestive AutoTextEditField?

Not tested it on reduced keyboard devices yet but I'm gona hope for the best lol.

 

Not too hard to make really, just make a custom editfield, pass in a list/collection/array of String "keywords" that you wish and start typing, capture a character and replace the word..

 

Although what I did was made sure that a minimum of 3 characters were entered before it checked the list of words  so that it gets the near best match first time round.

 

 Also if it has "suggested" a word then the first delete will delete the "suggested" word and replace what the user had time..

 

The logic behind it is pretty simple, I've just been busy with other things, only takes a few minutes to write  :smileytongue:

Genius Development Scotland
Website: http://www.genius-dev.co.uk
Developer
peter_strange
Posts: 19,609
Registered: ‎07-14-2008
My Device: Not Specified

Re: Help! How to make a suggestive AutoTextEditField?

Sounds good.  Thanks for letting us know