I have a situation that uses 5 DBEdit boxes. 4 of these boxes are involved with Integer data, while the fifth requires decimal places and is therefore involved with double numbers.
The calculations that occur need to be updated after each key press, which means that the data gets posted on every keypress from the DBEdit that has the current focus, after which the calculation functions correct the four fields.
This works fine with the integer numbers. However, with the double numbers, there is a problem.
If a solid number is typed, for example :- 4325
Everything is fine, but as soon as the '.' is pressed to insert a decimal number, after posting, the decimal is removed since the display rounds off the number since there is zero to the right of the decimal point.
In order to display the number as a fixed decimal number, the number needs to be formated as a string and then DBEdit.Text := FormatedString.
So if I reformat the data after post and send it to the DBEdit text, once focus is again on DBEdit, the cursor is to the left of the data.
Since posting occurs onkeypress, the whole situation does not work.
I managed to get a perfectly workable solution with an Edit box, but there is one issue there that I can not resolve.
The data in the DBEdit boxes is aligned to the left when focused and to the right when focus is elsewhere, while the Edit Box, the alignment is to the left while focused and remains to the left when focus is elsewhere.
I could not find any way to set either the DBEdit box or the Edit Boxes alignment so that they all are viewed the same.
So, if anyone can assist either in resolving the DBGrid decimal point issue, or alternatively assist with the alignment issue, I would be grateful.
Thank you for reading this long saga