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
Posts: 53
Registered: ‎11-13-2009
My Device: Not Specified

Basic edit field. Phone Number style + underscore character?

[ Edited ]

Hi Guys and girls,

 

I'm trying to customise my basic edit field to allow for 0-9 A-Z a-z and the underscore character. It's this underscore character which is proving to be a problem.

 

I've set the basic edit field to have the phone number style. Which works great until I tried to use the underscore character (i know i know phone numbers can't have underscores). I looked into extending the basic edit field and specifically overriding the keyChar function. However I got stuck, how do I preserve that key presses without the alt key enter numbers and key pressed with the alt key display the letters. Plus this pesky underscore character.

 

Anyhelp would be greatly greatly appreciated!

 

Regards,

 

Alan

 

 

Developer
Posts: 53
Registered: ‎11-13-2009
My Device: Not Specified

Re: Basic edit field. Phone Number style + underscore character?

One quick bump? Any advice/suggestions a point in the right direction would be appreciated.

 

I'm still stumped! :smileyhappy:

Developer
Posts: 101
Registered: ‎07-20-2009
My Device: Not Specified

Re: Basic edit field. Phone Number style + underscore character?

if you are trying to create your own edit field, then you can have your own list of validations. Please refer to CharacterUtilitis class which may help you.

Developer
Posts: 53
Registered: ‎11-13-2009
My Device: Not Specified

Re: Basic edit field. Phone Number style + underscore character?

Thank you Karan, you actually pointed me in the right direction. I managed to implement it in the end by extending a TextFilter and overriding the convert and validate meathods. Then I realised it wasn't actually wanted to do anyway... C'est la vie :smileyhappy: 

 

Thanks again,

 

Alan