Float precision is only for the display of strings, not internal
calculations, and not for editable fields.
In other words, if you have a float variable r, it might equal 3.14159
r=3.14159
put r
-- 3.1416
(note - default precision is 4, so it rounds when displaying)
set the floatPrecision =2
put r
-- 3.14
set the floatPrecision =5
put r
-- 3.14159
However, if you're trying to control an edit fields, that's different. As
far as director is concerned, it's just a string. It doesn't pay attention
to whether or not you're entering decimals or letters, or IP addresses or
Morse code... it doesn't care. If you want to limit the field, you'll have
to secretly absorb the keypresses, then display only the ones you want. In
other words, make it a non-editable field, suck up the keypresses, build
the string on the fly, and display it.
Alternatively you could probably use the keyDownScript to intercept the
keypresses and decide if you want to pass them on, but I haven't tried that
for years and don't remember if it'll cut it or not...
- Tab
At 12:58 PM 7/10/01 -0400, Gene Fritzinger wrote:
>Hi all,
>I'm trying to have a field member always display 4 decimal places as the
>user enters a dollar amount. I've tried adding the (set the
>floatPrecision = 4) to the movie script but when I test by typing into the
>field, it doesn't display the decimal or the 4 decimal places to the
>right. Can anyone suggest what I may be doing wrong?
>
>Thanx again,
>g fritzinger
>
>on startMovie
> set the floatPrecision = n
>end
>
>--n is the number of decimal places included
>
>Alberto
>
>Gene Fritzinger wrote:
>
> > Hi List,
> > I have a field member which is populated with "0.0000" when first
> clicked. This field is representing a dollar amount. As the user types
> in a new dollar amount, I want this dollar amount to always include 4
> decimal places. So if the user types in any number, that number should
> appear to the left of the decimal point. When they enter a period, that
> period should replace the decimal point already iin the field. Then any
> numbers entered after that should appear to the right of the decimal
> point, and should always include 4 decimal places. (Ex, 12.7500, or
> 2.9900, or 127.1000). Does anyone have a suggestions as to the best way
> to acheive the effect?
> >
> > Thanx in advance,
> > g fritzinger
>
>
>[To remove yourself from this list, or to change to digest mode, go to
>http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
>email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
>Lingo-L is for learning and helping with programming Lingo. Thanks!]
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo. Thanks!]