Pelles C forum

C language => Windows questions => Topic started by: tpekar on October 04, 2012, 10:57:18 PM

Title: ES_NUMBER does not allow periods?
Post by: tpekar on October 04, 2012, 10:57:18 PM
I am trying to restrict user input to just numbers and I find that in doing so ES_NUMBER will not allow the input of a period.  How does the user input a decimal point?
Title: Re: ES_NUMBER does not allow periods?
Post by: CommonTater on October 04, 2012, 11:26:35 PM
Either remove the ES_NUMBER (which only allows integer values) or create a custom control.

If you remove ES_NUMBER you can check after each entry (catching EN_CHANGE) to ensure you have only characters from your own dictionary which, in this case would be "0123456789.,-"  and report an error if they mess up...

If you are inputting dollar values and assigning them to floats or doubles... you probably should read THIS (http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html) first.  Most monetary software works in integer pennies, for the very reason that floating point math is never exactly accurate.