Grid and float fields
Float fields raise exceptions if you enter invalid characters. Also by default you can enter "e".
How are these best handled? Should we use masks?
If so, what mask should be used for decimal?
tried #[#][#][.##]
but if the user enter 1. or 1.1 we still get an exception.
Dave Craggs
-
Exceptions generate a user message, so keep in mind that what you see with the debugger is more than what the user would see. If you need to use a picture mask, you can try something like...
*#[.]*#
Your current mask requires exactly two digits after the decimal point, so 1.1 is invalid based on this mask.
-Roy
-
Hi Roy,
Users have been getting exceptions, these have been captured by MadExcept and registered in our Mantis database.
Want to stop this, hence using masks.
What mask would I use if I wanted a fixed number of decimal places?
Thanks
Dave Craggs
PS - I am following this thread, but didn't get an email when you posted.
-
Not sure why I am not getting notifications on your posts.
Exceptions are a normal course of action in Delphi, and are not supposed to be avoided. I would think you can configure madexcept to not report all exceptions.
The mask I provided
*#[.]*#
allows for any number of digits after the decimal point. If you only want two you could change it to
*#[.][{#[#]}]
-Roy
Please sign in to leave a comment.
Comments
5 comments