0

RAD Studio 11.2 Found how to create your cell type in this way:

type
  TSpinBoxCell = class(TSpinBox)
  private
...............................
  protected
    constructor Create(AOwner: TComponent); override;
  end;
 
...............................
 
constructor TSpinBoxCell.Create(AOwner: TComponent);
begin
  inherited;
...............................
end;
 
procedure TForm1.StringGrid1CreateCustomEditor(Sender: TObject;
  const Column: TColumn; var Control: TStyledControl);
var
  XSpin: TSpinbox;
begin
  if Column.Index=5
  then 
  begin
    XSpin:= TSpinBoxCell.Create(nil);
    XSpin.TagObject := Column;
    XSpin.text:='1';
    Control := XSpin;
  end;
end;

The problem is that the spinbox is not displayed until you click on the cell 2 times, well, after switching to another cell, it disappears again and, accordingly, the result is not visible. What should I do to fix it?

Adriaan
  • 17,741
  • 7
  • 42
  • 75

0 Answers0