View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0004468 | JEDI VCL | 00 JVCL Components | public | 2008-09-22 04:57 | 2008-10-05 15:38 |
Reporter | gcornu | Assigned To | jfudickar | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 3.30 | ||||
Target Version | Fixed in Version | ||||
Summary | 0004468: TjvDBGrid, | ||||
Description | In TjvDBGrid, using BooleanEditor and CheckIfBooleanField on an integer field to get a checkbox editor. When I first click on the checkbox, a value of 10 (ten) is written in the field instead of 1 (one). Digging into the code I found the origin of the flaw in ChangeBoolean procedure. with an initial null value in the field and a FieldValueChange=9 (toggle flag) you enter in "if FBooleanFieldToEdit.IsNull or (FieldValueChange <> JvGridBool_INVERT) then" and end in "FBooleanFieldToEdit.Value := FieldValueChange + 1" where the value 9 (FieldValueChange) + 1 is written ending with a 10 value !! see additional information for suggested corrected code. | ||||
Additional Information | procedure TJvDBGrid.ChangeBoolean(const FieldValueChange: Shortint); // FieldValueChange = 9 -> invert, 0 -> check (true), -1 -> uncheck (false) begin if Assigned(FBooleanFieldToEdit) and BooleanEditor then begin DataLink.Edit; if DataLink.Editing then begin if FBooleanFieldToEdit.IsNull or (FieldValueChange <> JvGridBool_INVERT) then begin case FBooleanFieldToEdit.DataType of ftBoolean: FBooleanFieldToEdit.Value := (FieldValueChange = JvGridBool_CHECK); ftString, ftWideString: begin if FieldValueChange = JvGridBool_CHECK then FBooleanFieldToEdit.Value := FStringForTrue else FBooleanFieldToEdit.Value := FStringForFalse; end; else // ******* START OF CORRECTION ****** if FieldValueChange <> JvGridBool_INVERT then FBooleanFieldToEdit.Value := FieldValueChange + 1 else FBooleanFieldToEdit.Value := 1; // ******* END ********************** end; end else case FBooleanFieldToEdit.DataType of ftBoolean: FBooleanFieldToEdit.Value := not FBooleanFieldToEdit.AsBoolean; ftString, ftWideString: begin if AnsiSameText(FBooleanFieldToEdit.AsString, FStringForTrue) then FBooleanFieldToEdit.Value := FStringForFalse else FBooleanFieldToEdit.Value := FStringForTrue; end; else FBooleanFieldToEdit.Value := 1 - Abs(FBooleanFieldToEdit.AsInteger); end; InvalidateCell(Col, Row); end; end; FBooleanFieldToEdit := nil; end; | ||||
Tags | No tags attached. | ||||
|
Could you please create a small sample which shows this behaviour. It would help debugging the problem and your solution. Greetings and thanks Jens |
2008-09-25 01:47
|
[JEDI VCL 0004468].zip (4,439 bytes) |
|
Hello, I've just uploaded a sample demonstrating the bug. It uses standard components from Delphi and of course JVCL. You'll find also a screenshot showing the bug Thanks for your good work on JVCL Guillaume |
|
Commited to svn. Thanks for your analysis. |
Date Modified | Username | Field | Change |
---|---|---|---|
2008-09-22 04:57 | gcornu | New Issue | |
2008-09-24 14:57 | jfudickar | Note Added: 0014671 | |
2008-09-24 14:58 | jfudickar | Status | new => feedback |
2008-09-25 01:47 | gcornu | File Added: [JEDI VCL 0004468].zip | |
2008-09-25 01:50 | gcornu | Note Added: 0014686 | |
2008-10-05 15:36 | jfudickar | Status | feedback => resolved |
2008-10-05 15:36 | jfudickar | Resolution | open => fixed |
2008-10-05 15:36 | jfudickar | Assigned To | => jfudickar |
2008-10-05 15:36 | jfudickar | Note Added: 0014757 |