简体   繁体   中英

Delphi FMX stringgrid cell does not show checkboxes

Using Delphi 11.1 the application is of the FMX (Fire Monkey) type. I have a TStringgrid with a CheckColumn. 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.

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:

Eg 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

在此处输入图像描述

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM