BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 03-09-2009, 04:57 AM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: May 2007
Location: berlin, germany
Model: 8310
PIN: N/A
Carrier: vodafone
Posts: 163
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default float edit field

Please Login to Remove!

hi,
if i create a new EditField I can say taht only numbers are allowed. But what is if I want to enter a float value, e.g. $34.45 ?

is there a filter, too?

thanks hibbert
__________________
My English is so bad, that makes me nobody so quickly after
Offline  
Old 03-09-2009, 08:47 PM   #2 (permalink)
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Post Thanks: 20
Thanked 77 Times in 68 Posts
Default

How about a BasicEditField with BasicEditField.FILTER_REAL_NUMERIC specified in the style.
Offline  
Old 03-13-2009, 04:32 AM   #3 (permalink)
Thumbs Must Hurt
 
Join Date: May 2007
Location: berlin, germany
Model: 8310
PIN: N/A
Carrier: vodafone
Posts: 163
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

hey,
ok, but is there a way to say that only 2 chars are allowed after the point??

thanks hibbert
__________________
My English is so bad, that makes me nobody so quickly after
Offline  
Old 03-13-2009, 04:46 AM   #4 (permalink)
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

you can use two fields, the second one with a max input length. or check the input programmatically, either after the input or using keychar to control it while typing.
__________________
java developer, Devinto, hamburg/germany
Offline  
Old 03-14-2009, 07:44 PM   #5 (permalink)
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Post Thanks: 20
Thanked 77 Times in 68 Posts
Default

Or you can write your own input filter.
Offline  
Old 03-16-2009, 05:45 AM   #6 (permalink)
Thumbs Must Hurt
 
Join Date: May 2007
Location: berlin, germany
Model: 8310
PIN: N/A
Carrier: vodafone
Posts: 163
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi,
working with two EditFields.... that's not what i'm searching for. using the keychar would be a way, but the idea to Write an won InputFilter sounds interesting. How do i do this?

hibbert
__________________
My English is so bad, that makes me nobody so quickly after
Offline  
Old 03-16-2009, 07:51 AM   #7 (permalink)
Thumbs Must Hurt
 
Join Date: May 2007
Location: berlin, germany
Model: 8310
PIN: N/A
Carrier: vodafone
Posts: 163
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

ok, i have found how to create my own InputFilter:
Code:
setFilter(new TextFilter(){
But I only want to accept numbers and ',' or '.'. And if the User presses the 'W'-Key, then a '1' should be written into the box, but i don't know how to do this.

maybe someone can help me

thanks hibbert
__________________
My English is so bad, that makes me nobody so quickly after
Offline  




Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.