New topic: Ignore letters in a textfield?
<http://forums.realsoftware.com/viewtopic.php?t=32284> Page 1 of 1 [ 4 posts ] Previous topic | Next topic Author Message jip9 Post subject: Ignore letters in a textfield?Posted: Mon Feb 01, 2010 2:03 am Joined: Mon Feb 01, 2010 1:58 am Posts: 2 Hello, I'm new to RealBasic and I'm making a poker game. I was wondering if there is a way to have my textfield ignore letters and only allow the user to type numbers. I'd really appreciate any help I can get. Thanks! Top arnoldino Post subject: Re: Ignore letters in a textfield?Posted: Mon Feb 01, 2010 2:10 am Joined: Tue Oct 31, 2006 2:57 am Posts: 74 put this code in the editfield's KeyDown event: Code:if not IsNumeric(key) and not (asc(key)=8 or asc(key)=127) then Return True end if this code will allow only numeric characters and delete and backspace characters. if you want to allow arrow characters (->; <-,..) then you have to put the conditions in the second brackets. Top pbart Post subject: Re: Ignore letters in a textfield?Posted: Mon Feb 01, 2010 2:20 am Joined: Sat Oct 10, 2009 6:40 am Posts: 62 In the properties window for the textfield, there is a setting called Mask. If you only want to receive numbers use hashes. ### will allow you to enter 3 numbers, change the number of hashes to suit your App. _________________ Regards Paul Windows 7 32bit RB 2009 5.1 Top jip9 Post subject: Re: Ignore letters in a textfield?Posted: Mon Feb 01, 2010 3:21 am Joined: Mon Feb 01, 2010 1:58 am Posts: 2 Thanks!! Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 4 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
