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

Native Development

Reply
Super Contributor
JeffLemon
Posts: 440
Registered: ‎01-13-2011
My Device: Playbook
Accepted Solution

Custom Keyboard?

[ Edited ]

Is there a way to stop the keyboard from allowing the user to type symbols. I do not want them to be able to use characters such as:

 

/ + - = etc.

 

Thanks

--------------------------------------------------------------------------------------------------
BlackBerry Apps: Instruments | ARTPAD | Piano | Drums | Xylophone
Please use plain text.
Developer
Zmey
Posts: 1,512
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

Re: Custom Keyboard?

[ Edited ]

Other than replacing them after they were typed I think that's not possible.

 

I prefer a post-validation approach until there's a better filtering API: i.e. let user type anything, but if the input is invalid display the hint below the TextField with suggested corrections.

 

Another approach is creating a custom keyboard (Container with ImageButtons), but this will require creating a custom input field too. This should work for apps like calculators. I think it's not possible to replace the system keyboard.

 

Btw, when analyzing diffs between 1673 and 2318 SDK headers I've noticed that textFilter property appeared in TextArea control. I haven't tried to use it yet.

 

There's only one filter right now: SingleLineTextFilter.

https://developer.blackberry.com/cascades/reference/bb__cascades__singlelinetextfilter.html

 

Theoretically it should be possible to inherit from AbstractTextFilter to create other custom filters. UPD: seems it's not possible yet.

 


Andrey Fidrya, @zmeyc on twitter
Please use plain text.
Super Contributor
JeffLemon
Posts: 440
Registered: ‎01-13-2011
My Device: Playbook

Re: Custom Keyboard?

Thanks for the detailed response.

 

I decided to just remove the chars from the text using:

 

str.remove(QRegExp(QString::fromUtf8("[-`~!@#$%^&*()_—+=|:;<>«»,.?/{}\'\"\\\[\\\]\\\\]")));

 Thanks!

 

--------------------------------------------------------------------------------------------------
BlackBerry Apps: Instruments | ARTPAD | Piano | Drums | Xylophone
Please use plain text.