Re: How to enter a floating-point number ?



On Sat, May 29, 2004 at 09:40:47PM +1000, Russell Shaw wrote:

This is a parser problem. Every time a key is pressed, the callback
advances thru your implementation of a floating-point number parser.
When an invalid character is pressed, your callback can simply refuse
to accept the character, make a beep, and display an error message in
the status line. The parser is not hard (only 100 lines of code as
a switch-statement state machine).

IMHO this is a logical problem.

If you allow only things that correctly parse as floating
point numbers, the user will have hard time editing the
numbers, because after each key press the number has to be
parseable.  This is very annoying, especially for numbers
with an exponent.

But if you allow any transitional states, you'll lose you
point because there will be non-number things that can be
entered then, so you'll have to handle them anyway.

Yeti


--
Do not use tab characters. Their effect is not predictable.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]