I am using a NxSpinEdit control to display a float value with Precision = 0. If I assign a non-integer value to the control (for example 1.11), the control shows 1.11 instead of 1. If Precision is non-zero, the value is displayed with the correct Precision. I have not found a workaround.
- Phyllis
Problem with NxSpinEdit Precision
Started by knightware, Sep 13 2007 06:09 PM
8 replies to this topic
#1
Posted 13 September 2007 - 06:09 PM
#2
Posted 13 September 2007 - 06:16 PM
Hello Phyllis,
Please set eoAllowFloat in Options property to False.
I didn't predict situations when eoAllowFloat = True, and Precision = 0 which is equal to eoAllowFloat = False. I will fix this now.
Best regards
Please set eoAllowFloat in Options property to False.
I didn't predict situations when eoAllowFloat = True, and Precision = 0 which is equal to eoAllowFloat = False. I will fix this now.
Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
#3
Posted 14 September 2007 - 04:30 PM
I changed the eoAllowFloat option but that changes the Value property of the control. For example, value = 30.16, set eoAllowFloat = false, Value = 3016. I need the Value to remain 30.16 but the Text to become '30'.
Here is an example of what I am doing:
Suppose the control shows air pressure. For Metric Units mode, pressure is shown in millibars; for English Units mode, it is shown in hundredths on inches. In either case I want the underlying value to be kept as a double to minimize rounding errors. So when showing millibars, I want a double value displayed with 0 decimal digits and rounded; when showing inches, I want a double value displayed with two decimal digits and rounded.
Is this simply 'not as designed'?
Thanks in advance,
- Phyllis
Here is an example of what I am doing:
Suppose the control shows air pressure. For Metric Units mode, pressure is shown in millibars; for English Units mode, it is shown in hundredths on inches. In either case I want the underlying value to be kept as a double to minimize rounding errors. So when showing millibars, I want a double value displayed with 0 decimal digits and rounded; when showing inches, I want a double value displayed with two decimal digits and rounded.
Is this simply 'not as designed'?
Thanks in advance,
- Phyllis
#4
Posted 14 September 2007 - 04:36 PM
Hi Phyllis
Have you tried using the FormatMask? (e.g "0.00" for two decimals etc)
Regards,
Deon
Have you tried using the FormatMask? (e.g "0.00" for two decimals etc)
Regards,
Deon
#5
Posted 14 September 2007 - 04:39 PM
Oops. Please ignore my last post.
I did not read your first post. NxSpinEdit does not have a FormatMask
I thought you were using a grid.
Sorry..
I did not read your first post. NxSpinEdit does not have a FormatMask
Sorry..
#6
Posted 14 September 2007 - 06:55 PM
QUOTE (knightware @ Sep 14 2007, 03:30 PM) <{POST_SNAPBACK}>
I changed the eoAllowFloat option but that changes the Value property of the control. For example, value = 30.16, set eoAllowFloat = false, Value = 3016. I need the Value to remain 30.16 but the Text to become '30'.
Here is an example of what I am doing:
Suppose the control shows air pressure. For Metric Units mode, pressure is shown in millibars; for English Units mode, it is shown in hundredths on inches. In either case I want the underlying value to be kept as a double to minimize rounding errors. So when showing millibars, I want a double value displayed with 0 decimal digits and rounded; when showing inches, I want a double value displayed with two decimal digits and rounded.
Is this simply 'not as designed'?
Thanks in advance,
- Phyllis
Here is an example of what I am doing:
Suppose the control shows air pressure. For Metric Units mode, pressure is shown in millibars; for English Units mode, it is shown in hundredths on inches. In either case I want the underlying value to be kept as a double to minimize rounding errors. So when showing millibars, I want a double value displayed with 0 decimal digits and rounded; when showing inches, I want a double value displayed with two decimal digits and rounded.
Is this simply 'not as designed'?
Thanks in advance,
- Phyllis
Hello Phyllis,
Unfortunatelly, Value is float representation of Text property. When you check Value property, text in Text property is converted (and validated for non-numbers) to float. There is no rounding, only slicing.
I have fix Precision problem and I may send you new NxEdit.pas file to you.
Best regarards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
#7
Posted 14 September 2007 - 11:33 PM
Hello,
I have made it to work in following way.
If eoAllowFloat is False, Precision is ignored, and it is actualy 0 (Decimal separator can't be typed).
If eoAllowFloat is True, Precision is used if Precision > 0. If Precision is 0, it is ignored.
Best regards
I have made it to work in following way.
If eoAllowFloat is False, Precision is ignored, and it is actualy 0 (Decimal separator can't be typed).
If eoAllowFloat is True, Precision is used if Precision > 0. If Precision is 0, it is ignored.
Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
#8
Posted 15 September 2007 - 04:43 PM
That sounds great. If you can send the source file I'll try it and see if this can work in my situation.
Thanks!
- Phyllis
Thanks!
- Phyllis
#9
Posted 15 September 2007 - 05:36 PM
Hello Phyllis,
Can you please contact me via e-mail and I will send you updated file.
Best regards
Can you please contact me via e-mail and I will send you updated file.
Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











