View Issue Details

IDProjectCategoryView StatusLast Update
0032383LazarusLCLpublic2018-09-09 17:23
ReporterStephanie Assigned ToJesus Reyes  
Status resolvedResolutionfixed 
Product Version1.8RC3 
Target Version1.10Fixed in Version1.9 (SVN) 
Summary0032383: TDbComboBox has problems to set data when item changes
DescriptionHello, I've noted that when the user changes the item in a TDbComboBox the associted data is not always changed. When the user moves to other controls, oft the value is automatically setted to the previous value. It is quiete difficolut to reproduce, I think when a Post command happens when the user move among the controls, set the previous values.

I've added a showmessage in the Change event, and also in the Exit event, the DbComboBox.Text is correct but the Field.AsString values remains to the old values.

In order to resolve the problem, I've made this patch on /lcl/include/

procedure TCustomDBComboBox.Change;
  //My new code:
    if FDataLink.CanModify then begin
      FDataLink.Field.AsString := Text;
    inherited Change;
  //Commented the old code because already in the finally of my code
  {inherited Change;}

The patch seems to work correctly.

Best regards,

TagsNo tags attached.
Fixed in Revisionr55894,58921
WidgetsetGTK 2
Attached Files


related to 0032463 closedwp Regression - TDBLookupComboBox raise exception 
related to 0029505 resolvedJuha Manninen TCustomDBComboBox does not call FDatalink.Edit 
related to 0032943 closedJesus Reyes TDBLookupComboBox and csDropDown - restore correct ItemIndex 
related to 0033160 closedwp Selected item in TDBComboBox when TDataSet are browse 
related to 0033164 resolvedJesus Reyes Start editing in DataSet through DBComboBox, application closes automatically 



2017-09-07 12:17



2017-09-07 12:23


patch_customdbcombobox.diff (522 bytes)   
--- /home/stephanie/Temp/	2017-09-07 14:05:08.619305000 +0200
+++ /home/stephanie/Temp/	2017-09-07 13:39:33.483732000 +0200
@@ -35,7 +35,15 @@
 procedure TCustomDBComboBox.Change;
-  inherited Change;
+  try
+    if FDataLink.CanModify then begin
+      FDataLink.Field.AsString := Text;
+      FDatalink.Modified;
+    end;
+  finally
+    inherited Change;
+  end;
+  {inherited Change;}
 function TCustomDBComboBox.GetReadOnly: Boolean;
patch_customdbcombobox.diff (522 bytes)   

Juha Manninen

2017-09-22 16:49

developer   ~0102980

Applied, thanks.
In future please create your patch from the Lazarus top level directory, like:
$ svn diff lcl/include/ > patch_customdbcombobox.diff

Now it had some strange paths, I had to use patch -p4 to apply it.
$ cd lcl/include/
$ patch -p4 < ~/patch/patch_customdbcombobox.diff

Also don't comment out removed code. Just remove it.


2017-12-30 21:02

developer   ~0105167

Last edited: 2017-12-30 22:58

View 2 revisions

Stephanie, I had to revert this patch because it had sideeffects crashing the DBCombobox as described in issue 0032463. I applied a different change in r56884, but since you did not supply a demo program I am not sure if the bug that you reported still exists.

Please test and report back

Jesus Reyes

2018-09-07 20:23

developer   ~0110551

The problem in this report seems to have been fixed by the last changes in dbcombobox.

There is a remaining problem though, updating the record relies on the user pressing ENTER or moving the focus to another control, and because almost any form of editing makes the control to become focused this is not a problem. But this is a problem when changing the item using the mouse wheel, because this works even when the control is unfocused.

Currently everything works, marking the field modified and putting the dataset in edit state, but if the control is not focused, then the record is not updated, and so the change is not propagated.

Delphi has not this problem because it seems it doesn't allow editing via the mouse wheel, so we have some improvement opportunity here, I think if we catch the mouse wheel event and use this to update the record it should work, it would be like pressing ENTER enter after any mouse wheel, what do others think?


2018-09-08 08:25

developer   ~0110555

Yes, might work.

I hope you don't mind if I re-assign this issue to you.

Jesus Reyes

2018-09-09 17:22

developer   ~0110599


Issue History

Date Modified Username Field Change
2017-09-07 12:17 Stephanie New Issue
2017-09-07 12:17 Stephanie File Added: patch_customdbcombobox.diff.7z
2017-09-07 12:23 Stephanie File Added: patch_customdbcombobox.diff
2017-09-22 16:33 Juha Manninen Assigned To => Juha Manninen
2017-09-22 16:33 Juha Manninen Status new => assigned
2017-09-22 16:49 Juha Manninen Note Added: 0102980
2017-09-22 16:50 Juha Manninen Fixed in Revision => r55894
2017-09-22 16:50 Juha Manninen LazTarget => -
2017-09-22 16:50 Juha Manninen Status assigned => resolved
2017-09-22 16:50 Juha Manninen Resolution open => fixed
2017-09-24 12:17 Juha Manninen Relationship added related to 0032463
2017-12-09 17:39 Juha Manninen Relationship added related to 0029505
2017-12-30 21:02 wp Note Added: 0105167
2017-12-30 21:02 wp Assigned To Juha Manninen => wp
2017-12-30 21:02 wp Status resolved => feedback
2017-12-30 22:58 wp Note Edited: 0105167 View Revisions
2018-01-10 17:45 Juha Manninen Relationship added related to 0032943
2018-02-12 16:53 wp Relationship added related to 0033160
2018-09-01 06:00 Jesus Reyes Relationship added related to 0033164
2018-09-07 20:23 Jesus Reyes Note Added: 0110551
2018-09-08 08:25 wp Note Added: 0110555
2018-09-08 08:25 wp Assigned To wp => Jesus Reyes
2018-09-08 08:25 wp Status feedback => assigned
2018-09-09 17:22 Jesus Reyes Fixed in Revision r55894 => r55894,58921
2018-09-09 17:22 Jesus Reyes Note Added: 0110599
2018-09-09 17:22 Jesus Reyes Status assigned => resolved
2018-09-09 17:23 Jesus Reyes LazTarget - => 1.10
2018-09-09 17:23 Jesus Reyes Fixed in Version => 1.9 (SVN)
2018-09-09 17:23 Jesus Reyes Target Version => 1.10