In Delphi 10.1 Berlin multi-application (Firemonkey)
On my form, if i place a TDBGrid with two columns (TCheckColumn, TStringColumn) I can fill the grid’s CheckColumn and check or uncheck columns using the code below. This uses the default style (windows). And seems to work fine.
However, if I use a style such as “Air” (which uses a TPath to draw the check mark, versus a bitmap), it does not seem to work very well. I have tried this with two different styles.
Why does this work fine with the default style (checkmarks = bitmap) and not the other styles (checkmarks = TPath)
You can find the Air style in the following folder:
EmbarcaderoStudio18.0RediststylesFmx
unit Unit2;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, System.Rtti,
FMX.Grid.Style, FMX.Grid, FMX.Controls.Presentation, FMX.ScrollBox,
FMX.StdCtrls;
type
TForm2 = class(TForm)
Grid1: TGrid;
CheckColumn1: TCheckColumn;
StringColumn1: TStringColumn;
StyleBook1: TStyleBook;
StyleBook2: TStyleBook;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
RadioButton3: TRadioButton;
procedure Grid1GetValue(Sender: TObject; const ACol, ARow: Integer;
var Value: TValue);
procedure Grid1SetValue(Sender: TObject; const ACol, ARow: Integer;
const Value: TValue);
procedure FormCreate(Sender: TObject);
procedure RadioButton1Click(Sender: TObject);
procedure RadioButton2Click(Sender: TObject);
procedure RadioButton3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
Arr: array of TValue;
end;
var
Form2: TForm2;
implementation
{$R *.fmx}
procedure TForm2.FormCreate(Sender: TObject);
var
i: integer;
begin
SetLength(Arr, Grid1.RowCount);
for I:= 0 to 9 do
arr[i]:= True;
end;
procedure TForm2.Grid1GetValue(Sender: TObject; const ACol, ARow: Integer;
var Value: TValue);
begin
if ACol = 0 then
Value := Arr[ARow];
end;
procedure TForm2.Grid1SetValue(Sender: TObject; const ACol, ARow: Integer;
const Value: TValue);
begin
Arr[ARow] := Value.AsBoolean;
end;
procedure TForm2.RadioButton1Click(Sender: TObject);
begin
form2.StyleBook:= nil; //default
end;
procedure TForm2.RadioButton2Click(Sender: TObject);
begin
form2.StyleBook:= Stylebook1; //air
end;
procedure TForm2.RadioButton3Click(Sender: TObject);
begin
form2.StyleBook:= Stylebook2; //master
end;