DBLookUpComboBox shows blank lazarus / 16-Databases ---------------------------------------------------------------------- mizar · 2015-12-12 12:19 I'm using a DBLookUpComboBox the usual way, i.e. to pick up a value from the SourceList DS and setting the corresponding field in the DataSource DS. The trouble is that the form comes up with the component blank.  I want it to show the current post field. As soon as I edit the DataSource DS everything is displayed correctly, but not when the form shows up. Using a simpler DBComboBox the underlying value is always shown correctly, but I lose the data-awareness of the SourceList. Any help appreciated. TIA. ---------------------------------------------------------------------- balazsszekely · 2015-12-12 15:11 Hi mizar, Something similar(see screenshots)?: http://bugs.freepascal.org/view.php?id=26356 ---------------------------------------------------------------------- mizar · 2015-12-12 15:31 First of all thank you for your reply. No, not the same issue. If I click on the embedded button I can see correctly all the items in SourceList. When the form shows up, the current record in DataSource has the Key field set at a valid value but the combo is blank. If I, as an example, move to the next record the combo shows the correct value and if I move back to the previous record, the combo shows the value as well. It doesn't work only at the beginning... ---------------------------------------------------------------------- balazsszekely · 2015-12-12 17:48 Quote@mizar f I, as an example, move to the next record the combo shows the correct value and if I move back to the previous record, the combo shows the value as well. It doesn't work only at the beginning... This is very strange indeed! Then, you should move to the next record, then back to the previous one programmatically   SQLQuery1.Next;   SQLQuery1.Prior; If this works, you can even disable the visual controls to prevent the flickering: Quote  SQLQuery1.DisableControls   try     SQLQuery1.Next;     SQLQuery1.Prior;   finally     SQLQuery1.EnableControls;   end; ---------------------------------------------------------------------- LuizAmérico · 2015-12-12 18:02 Can you post a sample project? ---------------------------------------------------------------------- DonAlfredo · 2015-12-12 21:03 Had the same problem ... very hard to solve. You can use two methods: 1: RefreshLookupList of lookupfield 2: DataSet.Resync([]); I use both ! ---------------------------------------------------------------------- mangakissa · 2015-12-13 08:29 Quote I want it to show the current post field. As soon as I edit the DataSource DS everything is displayed correctly, but not when the form shows up. In lazarus first you have to open the actual datasource and than the listsource. ---------------------------------------------------------------------- mizar · 2015-12-13 15:58 Thank you all, I'll post a sample project reproducing the issue as soon as possible, in the meantime: - reading http://wiki.freepascal.org/dblookupcombobox: Quote // The ComboBox should now be populated, however intially no text is displayed // So right now there is no relationship between the selected record in the dataset // and the contents of the ComboBox and proposes to set KeyValue property: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i cboLookup.KeyValue := dsetSource.FieldByName(FKeyField).AsVariant; Well, to avoid any streaming system related problem, I dropped a Button on the form and in the OnClick event I tried: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i cboLookup.KeyValue := dsetSource.FieldByName(FKeyField).AsVariant; and it works ! (the combo shows the value) Then tried: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i DataSet.Resync([]); Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i DataSet.Refresh; Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i DataSet.Next;DataSet.Prior; and they worked too; Instead: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i DBLookUPCombo.Refresh;Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i ListSource.Refresh;Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i ListSource.Resync([]);Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i ListSource.Close;ListSource.Open;Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i DataSet.FieldByName(...).RefreshLookupListCode: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i ListSource.FieldByName(...).RefreshLookupList none of them worked. Now I have to decide in which form's event I have to put the code. Btw, RXDBLookUpComboBox works out of the box (but it's not so uniform to the other controls). (fpc 3.0.0, Lazarus 1.4.4 on linux x64)