Sorry, Harald. I must need new glasses. Thanks for pointing out the right solution, Philippe.

 

A \ in a string literal is always treated as an escape character, so you have to write "\\-" in order to set the 'restrict' property to backslash + minus, which the TextField in the TextInput then interprets as meaning "allow a minus sign".

 

- Gordon

 


From: [email protected] [mailto:[email protected]] On Behalf Of Philippe Maegerman
Sent: Tuesday, March 28, 2006 4:04 AM
To: [email protected]
Subject: RE: [flexcoders] Flex 2 Beta 2 - Bug with mx.controls.TextInput restrict Property

 

TI.restrict = '0-9\\-'

 

Pim

 


From: [email protected] [mailto:[email protected]] On Behalf Of Harald Dehn
Sent: mardi 28 mars 2006 10:18
To: [email protected]
Subject: AW: [flexcoders] Flex 2 Beta 2 - Bug with mx.controls.TextInput restrict Property

Hello Gordon,

 

Please look at the example: TextInput.restrict = "0-9 ,.\-" There is a backslash before the minus sign, but it doesn’t work.

 

Harry

 

 

 


Von: [email protected] [mailto:[email protected]] Im Auftrag von Gordon Smith
Gesendet: Dienstag, 28. März 2006 09:04
An: [email protected]
Betreff: RE: [flexcoders] Flex 2 Beta 2 - Bug with mx.controls.TextInput restrict Property

 

No; 'restrict' specifies what is accepted, not what is rejected.

 

The problem is that the minus sign (a.k.a. hyphen) is a metacharacter: look at how you're using it in 0-9 to mean 0 through 9. So you have to "escape" it by preceding it with a backslash.

 

- Gordon

 


From: [email protected] [mailto:[email protected]] On Behalf Of Matt Chotin
Sent: Monday, March 27, 2006 10:48 PM
To: [email protected]
Subject: RE: [flexcoders] Flex 2 Beta 2 - Bug with mx.controls.TextInput restrict Property

 

Well you’re including the minus character in your restrict.  So it shouldn’t allow negative numbers.

 


From: [email protected] [mailto:[email protected]] On Behalf Of Harald Dehn
Sent: Saturday, March 25, 2006 6:37 AM
To: [email protected]
Subject: [flexcoders] Flex 2 Beta 2 - Bug with mx.controls.TextInput restrict Property

 

Hello

 

I try to restrict the input of a TextInput Control with the following line:

 

TextInput.restrict = "0-9 ,.\-" + _CurrencySymbol;

 

Unfortuneally I can’t enter negative numbers in the box (it don’t accept the minus character). This example worked fine with the alpha version of Flex, I already reported the bug for the beta 1 version.

 

Harry

 






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




YAHOO! GROUPS LINKS




Reply via email to