Why is this combobox misbehaving? lazarus / 31-LCL ---------------------------------------------------------------------- EganSolo · 2021-05-01 22:31 Windows 10, Laz 2.0.12, svn:64642 I think there's a bug with TComboBox. If you set editor to the spinedit, then everything works as expected. If you set it to the combobox, the box does not cover the full width of the cell. You can see the difference when you look at the two attached images. Here's the code. The simple project is included as a zip. 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 unit misbehavingcb_main; {$mode objfpc}{$H+} interface uses   Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ValEdit, StdCtrls, Grids; type    { TForm1 }    TForm1 = class(TForm)      ComboBox1: TComboBox;      SpindEdit1: TSpinEdit;      ValueListEditor1: TValueListEditor;      procedure ValueListEditor1SelectEditor(Sender: TObject; aCol,         aRow: Integer; var Editor: TWinControl);   private    public    end; var   Form1: TForm1; implementation {$R *.lfm} { TForm1 }  procedure TForm1.ValueListEditor1SelectEditor(Sender: TObject; aCol,   aRow: Integer; var Editor: TWinControl);begin   If (aCol = 1) and (aRow = 1)   then begin      //editor := SpinEdit1;   //Uncomment this line and comment the next to see that the code works fine with a TSpinEdit.       editor := combobox1;       editor.BoundsRect := valueListeditor1.CellRect(aRow,aCol);   end;end; end.  On running this, the combobox shows in the right cell (Col:1, Row:1) but it doesn't cover the full width of the cell. If I click on cell (col:0,row:1), then click back on cell (col:1, row:1), the combobox displays as expected. Any idea why this is misbehaving? ---------------------------------------------------------------------- jamie · 2021-05-02 03:57 its the value list editor that is doing it. if the list editor is the first control to get focused during startup the value reported for the CellRect is short for the width and the next time you click on the cell it then reports the correct value and the combobox is sized property..  if you place a button or some other control on the form and then set the active form property in the fOrm to point to that instead during startup you will see if another control gets focus first it gives the list editor a chance to complete what its doing and will report the correct Cellrect sizes when you click on the value cell.  This only seems to happen during initial start of the control if it has focus.. ---------------------------------------------------------------------- wp · 2021-05-02 11:54 I can confirm this observation. But it sounds like a bug. Because the grid already has been painted correctly and thus the grid must know the width of the cell. And it must be something in the ValueListEditor because the same OnSelectEditor handler applied to a TStringGrid works correctly. ---------------------------------------------------------------------- jamie · 2021-05-02 14:24 in the process of looking at this I found another bug that is caused by a patch (Issue 0029993) which looks like makes the Display option doKeyColFixed work backwards.  You turn it on, it allows you to adjust the Key column width, turn it off and it locks it.. I can't be real sure if that patch cause that but looking at this code. 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       inherited SetFixedRows(1);// don't do FixedRows := 1 here, it wil cause infinite recursion (Issue 0029993)    end else      inherited SetFixedRows(0);                                                              You see there is no attempt to restore the original value, it just sets it to 0 (false); More to come I am sure. ---------------------------------------------------------------------- jamie · 2021-05-02 16:48 Apparently if you turn off the "doAutoColResize" in the DisplayOptions the problem goes away, something to do with "AutoFillColumns" and as a reminder the "doKeyColFixed" appears to be working backwards and is also ignored in various places. This is of course in the ValEdit file ---------------------------------------------------------------------- jamie · 2021-05-03 21:55 it appears this control needs a little rework..  For one thing the Method LOADED isn't implemented from what I can see? This causes to the custom grid to complete early and start calling events before the ValueListEditor has completed with its property loading etc...   Maybe others are using a String Grid variant instead..