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.
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?