Formating numbers in fields
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? Andrew Kluthe -- View this message in context: http://n4.nabble.com/Formating-numbers-in-fields-tp1589177p1589177.html Sent from the Revolution - User mailing list archive at Nabble.com. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Formating numbers in fields
On 11/03/2010 17:57, Andrew Kluthe wrote: 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? Andrew Kluthe I'm only a code gorilla . . . :) numberFormat Love, Richmond. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Formating numbers in fields
I tried setting that property and I must not know how to use it properly because I could not figure it or the documentation on it out. Do I set this as a property of the field and it handles all that for me? or? From the dictionary: Examples: set the numberFormat to #.00 -- dollar format set the numberFormat of scrollbar Progress to 0.0 so set the numberFormat of fld fLeasePaymentDollars tp #.## doesn't work. How do I use this thing? -- View this message in context: http://n4.nabble.com/Formating-numbers-in-fields-tp1589177p1589213.html Sent from the Revolution - User mailing list archive at Nabble.com. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Formating numbers in fields
no, you cannot set the numberformat of a field. what you can do is (for example) this: on KeyUp --after someone entered something into the field set the numberformat to #.00 put the selectedChunk of me into theTempSelection --retain selection add 0 to me --force numberformat select char (word 2 of theTempSelection) to (word 4 of theTempSelection) of me end KeyUp Note that this is a rather evil approach, mostly because there's no way to enter the right hand parts without using arrow navigation or mouse selection. Also, the code throws an error when a point or any non-number char is entered. Maybe it's more advantageous to use two fields, or only check on exitField and closeField, because there it's not as intrusive to interpret and remove wrong chars or double dots etc. but that of course depends on what you've actually planned. Finally, these messages might also need to be handled: on pasteKey on cutKey on closeField On 11 Mar 2010, at 17:16, Andrew Kluthe wrote: I tried setting that property and I must not know how to use it properly because I could not figure it or the documentation on it out. Do I set this as a property of the field and it handles all that for me? or? From the dictionary: Examples: set the numberFormat to #.00 -- dollar format set the numberFormat of scrollbar Progress to 0.0 so set the numberFormat of fld fLeasePaymentDollars tp #.## doesn't work. How do I use this thing? -- View this message in context: http://n4.nabble.com/Formating-numbers-in-fields-tp1589177p1589213.html Sent from the Revolution - User mailing list archive at Nabble.com. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Formating numbers in fields
On 11/03/2010 18:16, Andrew Kluthe wrote: I tried setting that property and I must not know how to use it properly because I could not figure it or the documentation on it out. Do I set this as a property of the field and it handles all that for me? or? From the dictionary: Examples: set the numberFormat to #.00 -- dollar format set the numberFormat of scrollbar Progress to 0.0 so set the numberFormat of fld fLeasePaymentDollars tp #.## doesn't work. How do I use this thing? Probably because you are making a mess with your quotes . . . :) Try this: http://andregarzia.on-rev.com/richmond/STUFF/CRUNCH.rev.zip works perfectly! ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Formating numbers in fields
Pefect BvG (is it ok if I call you BvG?)! This is exactly what I was looking for and tried to do but couldn't get to work right on keydown. The closeField handler makes it do EXACTLY what I want. Thanks a mill. Andrew K -- View this message in context: http://n4.nabble.com/Formating-numbers-in-fields-tp1589177p1589316.html Sent from the Revolution - User mailing list archive at Nabble.com. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Formating numbers in fields
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_didacticielsl=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 use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution