Le 11 mars 10 à 16:57, Andrew Kluthe a écrit :


I have been over alot of the other formatting threads on the list and can't
exactly find what I am looking for.

Basically, I have a field that is supposed to have the number format "#.##" in it. I want to set it up so that you can enter as many numbers as you want before the decimal but after the decimal it only shows and allows you to enter two numbers. I have tried doing this several ways and just cannot come up with one that works as it should. This should be simple for the code
guerrillas on this list.

the logic I have pinned down so far.

on keydown
if "." is in the field and if "." key is being pressed don't pass keydown
if "." is in the field then check to see if "." is in char -3
if "." is not in char -3 then ?
end keydown


Serious brainfart. halp?

Bonjour,
You might want to have a look at the tutorial from Éric Chatonet "#020 How to master users data in entry boxes"
at So Smart Software:
http://www.sosmartsoftware.com/?r=revolution_didacticiels&l=en

 I just tried the following (following one your idea:

- make a field "entryBox"
- and a field "allData"
In the script of the field "entryBox":
------------
on keydown pKey
if pKey is an integer or pKey is "." then pass keydown -- allow numbers only

on rawKeyUp
   local decimal,
   -----
if fld "entryBox" contains "." and char -3 of fld "entryBox" is "." then
      put fld "entryBox" & cr after fld "allData"
      put empty into fld "entryBox"
   end if
end rawKeyUp
---------------
HTH

Best regards from Grenoble

André



_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to