realbasic-nug
[Top] [All Lists]

Re: Numeric editfield

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Numeric editfield
From: Tom Benson <tombenson at mac dot com>
Date: Sun, 30 Jan 2005 11:13:11 +1100
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <20050129151617 dot 11096 dot qmail at web50908 dot mail dot yahoo dot com> <640F5B02-7225-11D9-876F-000393C6C4C4 at hit dot net>
I've got a custom EditField class that has a dictionary property which holds values for allowed character codes....

holler if you want a copy....

you just pass the allowed character codes to it using "me.allow(code as integer)" in it's open event...

Cheers,
Tom


'allow numbers, arrows, and delete key
If (Key >= "0" and Key <= "9") or (Key >= chr(28) and Key <= chr(31)) _
      or (asc(Key) = 8) then return false

  'allow one decimal point
  If Key = "." then return (Instr(me.text, ".") <> 0)

  'allow a leading minus sign if accepting negative numbers
  If Key = "-" then return (me.SelStart <> 0)

  Return true



Hello.

I'm sure this must exist, but after looking in quite a
lot of places I don't see it.

I want an editfield that accepts numbers. The mask
property does not do what I want. I would like to
allow the user to type a decimal point at any place in
the field and then accept no more decimal points.

I could make this, but I thought it must be out there
somewhere.

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>