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
tklanilkumar
Posts: 206
Registered: ‎02-22-2011
My Device: BB TORCH & 9800
My Carrier: idea
Accepted Solution

BasicEditField style issue

[ Edited ]

Hi All

 

Im using BasicEditField in that , I need to enter the characters in all CAPITALS so  I used the style "BasicEditField.FILTER_UPPERCASE",  when I did it I able to enter the characters in capitals but im not able to enter the SPACE.  I observerd in Virtual_KEY_BOARD in that space key is disabled.

 

 Even "BasicEditField.FILTER_UPPERCASE|BasicEditField.FILTER_DEFAULT" is also failed. So how to achieve it, could any one guide me.

 

Thanks in Advance

Anil

*****************************************************************************
* Give kudos when you like it
* Mark it as a solution if it fixes your issue
Please use plain text.
Developer
peter_strange
Posts: 19,599
Registered: ‎07-14-2008
My Device: Not Specified

Re: BasicEditField style issue

Give this a try.

 

     UppercaseTextFilter uptf = new UppercaseTextFilter() {
      public char convert(char character, int status) {
       if ( character == Characters.SPACE ) {
        return character;
       }
       return super.convert(character, status);
      }
      public boolean validate(char character) {
       if ( character == Characters.SPACE ) {
        return true;
       }
       return super.validate(character);
      }
     };
     BasicEditField bef = new BasicEditField("Test upper case: ", null);

 

I think bef has the correct attributes for you. 

Please use plain text.
Developer
tklanilkumar
Posts: 206
Registered: ‎02-22-2011
My Device: BB TORCH & 9800
My Carrier: idea

Re: BasicEditField style issue

Yeah Peter, I got it by your valuable snippet.

I added bef.setFilter(uptf);

then its given what I needed.

Thaks
Anil
*****************************************************************************
* Give kudos when you like it
* Mark it as a solution if it fixes your issue
Please use plain text.