TTMSFMXTileList and tile color

Hi


there is a way to assign a color by code to a tile when i create it ? for example 

Var itTab: TTMSFMXTile;
  shp: TTMSFMXTileShape;

    tlTables.BeginUpdate();
    While Not DM.dstTables.Eof Do Begin
      itTab:=tlTables.Tiles.Add();
      itTab.Caption:='Tav. '+DM.dstTables.FieldByName('Table_Number').AsString;
      itTab.Notes:=DM.dstTables.FieldByName('Seat_Number').AsString+' posti';

      shp := itTab.Shape;   // THIS DOES NOT HAVE AFFECT !!
      if Assigned(shp) then
        shp.Fill.Color:=claGreen;

      DM.dstTables.Next();
    End;

or i must use styles ?

You need to force the style for newly added elements:


procedure TForm1.FormCreate(Sender: TObject);
var
  itTab: TTMSFMXTile;
  shp: TTMSFMXTileShape;
begin
  itTab := TMSFMXTileList1.Tiles.Add();
  itTab.Caption := 'caption';
  itTab.Notes := 'notes';

  TMSFMXTileList1.NeedStyleLookup;
  TMSFMXTileList1.ApplyStyleLookup;

  shp := itTab.Shape;
  if Assigned(shp) then
    shp.Fill.Color := claGreen;
end;

But the best approach would be to set the color via the OnCustomizeTile:

procedure TForm1.FormCreate(Sender: TObject);
var
  itTab: TTMSFMXTile;
begin
  itTab := TMSFMXTileList1.Tiles.Add();
  itTab.Caption := 'caption';
  itTab.Notes := 'notes';
end;

procedure TForm1.TMSFMXTileList1CustomizeTile(Sender: TObject;
  ATile: TTMSFMXTile; ATileShape: TControl);
begin
  ATile.Shape.Fill.Color := claGreen;
end;

thank u

Now if i put an image in 


procedure TForm1.FormCreate(Sender: TObject);
var
  itTab: TTMSFMXTile;
begin
  itTab := TMSFMXTileList1.Tiles.Add();
  itTab.Caption := 'caption';
  itTab.Notes := 'notes';

  itTab.Bitmap.LoadFromFile(DM.FOLD_IMG+'\UmbrellaFree.bmp'); <---- CRASH
end;
Is not a path problem but loading an image. can u help me ?



on android

We have investigated this here but this seems to be an FireMonkey/Android specific issue. Loading a PNG does not throw an error.