On Tue, 9 May 2006 09:01:33 +0100 REALbasic NUG was sent the following email

> In a message regarding Re: Mask dated Mon, 08 May 2006 22:00:51 -0700,
> Terry Ford said that ...
> > PS. Roll your own is still the best using the KeyDown event.

> I have a simple Editfield Subclass using KeyDown and LostFocus at
> <http://rb.sgarman.net/numfield.rbp>

> It's just something I've knocked together this morning for numeric input
> only.
> I'd be glad if people would take a look at it and try to break it for me.

> Usage Notes follow:

> Place this class in your project

> Drag an EditField onto your window and change its Super to
> sjgNumField

> In the Properties pane, set appropriate values for
> DecimalPlaces
>    (0 = Integer, 2 for Dollars & Cents etc.)
> MinValue
>   (e.g. -1000.00)
> MaxValue
>   (e.g. 1000.00)

> If you wish to allow minus signs(-), then MinValue must be negative.

> If you wish to allow plus signs(+), then MaxValue must not be negative.

> //------------------------------------------------------------------------

> If the user enters an invalid character into the string, the keyDown event
> attempts to catch it and refuse to accept it.

> When the control loses focus
> 1) If the entry is valid, it is reformatted to a simple numeric mask based
> on the DecimalPlaces
> 2) If the entry is invalid,the InvaldEntry event fires. It is the
> programmer's responsibility to take the appropriate action





--
Steve Garman
Using REALbasic 2006r2 Professional on Windows XP Pro



_______________________________________________
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>
  • Re: Mask Steve Garman

Reply via email to