0

Using Delphi 11.1 the application is of the FMX (FireMonkey) type. I have a TStringgrid with a TCheckColumn. The grid does not show the checkbox. If I click two times on the cell the state changes and the the box is shown, after that it behaves normally.

I set the value of a cell in code like

StringGrid1.Cells[CHECKBOX_COLUMN, iIndex]:= BoolToStr(False);

Reading like

boMyBoolean := StringGrid1.Cells[CHECKBOX_COLUMN, 0].ToBoolean;

Help is very much appreciated.

user741461
  • 49
  • 7

1 Answers1

0

BoolToStr has two arguments:

function BoolToStr(B: Boolean; UseBoolStrs: Boolean = False): string;

If you call it with UseBoolStrs = True then the StringGrid reacts as you expect:

E.g. during FormCreate:

procedure TForm5.FormCreate(Sender: TObject);
begin
  StringGrid1.Cells[0, 1] := BoolToStr(False, True);
  StringGrid1.Cells[1, 1] := BoolToStr(False, True);
end;

where the first column is a TCheckColumn and the second column is a TStringColumn shows

enter image description here

And reacts as you expect it to, to subsequent changes.

Tom Brunberg
  • 20,312
  • 8
  • 37
  • 54