View Issue Details

IDProjectCategoryView StatusLast Update
0023243LazarusLCLpublic2014-10-18 00:07
ReporterStefanoAssigned ToJesus Reyes 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version1.0.2Product Build 
Target Version1.4Fixed in Version1.3 (SVN) 
Summary0023243: TFields - DbGrid error with not valid Currency/Float
DescriptionHello, with Lazarus 1.0.2 on Mac/Carbon if the user try to enter a not valid number in a Currency/Float cell of a DbGrid an error occours (press ok to confirm and risk data corruption or cancel to exit).

I remember thar a similar problem occoured with Lazarus 0.9.13 (all interfaces). Now the problem affect only Mac/Carbon, on Win/Linux-Gtk2 Lazarus works fine.

Best regards,

Stefano
TagsNo tags attached.
Fixed in Revision46574
LazTarget1.4
Widgetset
Attached Files

Activities

Stefano

2013-01-17 23:56

reporter   ~0064977

Hello, the problem seems to affect all version of Lazarus.

On Linux/GTK2 I obtein the same error, if the user digits a not valid currency.

For example, if the user digits 23,,72 the user receive this message:

"23,,72 is not a valid float. Press OK to ignore and risk data corruption. Press Cancel to kill the program.

Best regards,

Steafno

2013-01-17 23:57

 

CurrencyError.png (15,122 bytes)
CurrencyError.png (15,122 bytes)

Stefano

2013-11-12 10:54

reporter   ~0071278

Last edited: 2013-11-12 15:39

View 2 revisions

Might someone please change the subject of the bug without references to Mac Os X - Carbon, as the problem affect all widgetsets?

Thank you very much.

Best regards,

Stefano

Jesus Reyes

2014-10-11 22:51

developer   ~0078165

Last edited: 2014-10-11 22:51

View 2 revisions

DbGrid error with not valid Currency/Float.... So you mean the grid does wrong because it doesn't accept an invalid value and it should accept it?

Another possibility is that you think the message dialog is wrong?

So what you think is the error here? and what should we do in order to correct it

Stefano

2014-10-12 23:47

reporter   ~0078183

Hello, excuse me for my bad English. I think it would be good if the program doesn't crash, for example if for an invalid value the grid doesn't accept the data and put the previous values (undo) or null, or a property UndoInvalid can do this.

Actually it is necessary to use the Application.OnException to avoid crash due to user invalid data.

Best regards,

Stefano

Jesus Reyes

2014-10-15 23:18

developer   ~0078262

Well, I'm still confused, the program should never crash in this case.

Well the program will be finished if you press the "cancel" button, but that is the expected behavior. But maybe I'm wrong and You really had found that it does crash if you press any other button or close the dialog in some other way?

Second (and I guess is what you want), you don't like the standard exception handling and instead you want a dialog with only one button (perhaps "ok")? and in this case you want the possibility of the value to get restored, or set the field value to null?.

Stefano

2014-10-16 11:12

reporter   ~0078271

Hello Jesus Reyes, sorry for my bad English, I try to explain me better. I think it would be nice to don't accept invalid data.

It would be super if when the user insert the digits, the first digit that make the number invalid wouldn't be accepted. For example, if the user inserts 0,,70 when it inserts the second comma, this shouldn't be accepted. If the user insert a letter, this shouldn't be accepted.

If this is not possibile, I personally find better that no error message appears, and the cell value is setted to the previous value or to null. This kind of messages make problems with the users, that find that as a crash of the program.

Eventually a property could be setted to choose the behaviour for not valid data: message dialog (as now), undo, null value, etc..

This might concern all data-aware components.

To do this, I must use a workaround with the Application.OnException, in all forms I make the undo, the workaround works gut, but it would be very appreciated if the data aware components could don't accept invalid data without error messages.

Best regards,

Stefano

Jesus Reyes

2014-10-17 05:56

developer   ~0078296

in r46574 I implemented an option in Application and ApplicationProperties classes: ExceptionDialog. One can choose from a couple of values aedOkCancelDialog (which implements the default backward compatible behavior) and aedOkMessageBox which will use a simple message box as default exception handler. The later option should help to those who want this (Delphi) compatible behavior and minimize the user perception that the app has crashed when pressing the cancel button. A discussion if the Delphi compatible solution should be the default, is better to do it in the mailing list.

For the remaining part of this problem I guess it's a won't fix (but as always, if somebody present a clean way of doing, patches are welcome :)).

Let me explain why I think this. To illustrate the kind of problems that is to properly adjust the DbGrid for editing numbers with decimals, the editor could be made, when the data type is numeric, to follow this pattern '["-"/"+"] N ["."/","] N', but what if the user wants to use scientific notation? where we will configure that? Scientific Notation require at least one additional symbol ("E") but it will cause problems when you want to introduce simple decimal numbers. Solving this would complicate things in ways I think we should not. So my opinion is that the DbGrid should remain as generic as possible.

Moreover you have recognized that this is not a DbGrid only problem, the contributed solution should cover all other db controls.

Jesus Reyes

2014-10-17 06:13

developer   ~0078297

some way the following didn't make it in the original resolving note.....


Moreover you have recognized that this is not a DbGrid only problem, the contributed solution should cover all other db controls.

Not everything is loss, if you replace the standard DbGrid by the jujibo utils DbGrid you can solve this specific problem of preventing the user from wrongly typing. Check jujibo utils at http://wiki.lazarus.freepascal.org/jujiboutils. Among other things, the jujibo DbGrid prevents the user from typing "," twice. All jujibo controls where designed with the problematic typing user in mind (and those that want to do things quick, easy and right too). The case of jujibo DbGrid is very (if not 100%) compatible with standard DbGrid. You can even replace a DbGrid in the form editor by using the "Change Class ..." option that appears if you right click the DbGrid component. In the dialog that appears, one could select (provided that jujibo utils where installed of course) TJDBGridControl from the comobobox, if the jujibo utils package were not added as a requisite previously, the IDE will inform you that a requirement for it will be added automatically.

BTW, jujibo dbgrid doesn't allow entering numbers in Scientific Notation :)

Cyrax

2014-10-17 20:21

reporter   ~0078314

Looks like that there is spelling error in "FExceptionDialotType: TApplicationExceptionDlg;". Mattias removed the correct one in r46577.

Jesus Reyes

2014-10-17 21:19

developer   ~0078319

fixed in r46582, thanks.

Stefano

2014-10-18 00:07

reporter   ~0078321

Thank you very much, I'll give a look to jujibo.

Best regards,

Stefano

Issue History

Date Modified Username Field Change
2012-10-29 17:09 Stefano New Issue
2013-01-17 23:56 Stefano Note Added: 0064977
2013-01-17 23:57 Stefano File Added: CurrencyError.png
2013-02-11 08:19 Jesus Reyes Status new => assigned
2013-02-11 08:19 Jesus Reyes Assigned To => Jesus Reyes
2013-11-12 10:54 Stefano Note Added: 0071278
2013-11-12 15:39 Stefano Note Edited: 0071278 View Revisions
2014-10-11 22:46 Jesus Reyes LazTarget => -
2014-10-11 22:46 Jesus Reyes Summary Mac Os X - Carbon: TFields - DbGrid error with not valid Currency/Float => TFields - DbGrid error with not valid Currency/Float
2014-10-11 22:51 Jesus Reyes Note Added: 0078165
2014-10-11 22:51 Jesus Reyes Status assigned => feedback
2014-10-11 22:51 Jesus Reyes Note Edited: 0078165 View Revisions
2014-10-12 23:47 Stefano Note Added: 0078183
2014-10-12 23:47 Stefano Status feedback => assigned
2014-10-15 23:18 Jesus Reyes Note Added: 0078262
2014-10-16 11:12 Stefano Note Added: 0078271
2014-10-17 05:56 Jesus Reyes Fixed in Revision => 46574
2014-10-17 05:56 Jesus Reyes LazTarget - => 1.4
2014-10-17 05:56 Jesus Reyes Note Added: 0078296
2014-10-17 05:56 Jesus Reyes Status assigned => resolved
2014-10-17 05:56 Jesus Reyes Fixed in Version => 1.3 (SVN)
2014-10-17 05:56 Jesus Reyes Resolution open => fixed
2014-10-17 05:56 Jesus Reyes Target Version => 1.4
2014-10-17 06:13 Jesus Reyes Note Added: 0078297
2014-10-17 20:21 Cyrax Note Added: 0078314
2014-10-17 21:19 Jesus Reyes Note Added: 0078319
2014-10-18 00:07 Stefano Note Added: 0078321