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 ?
Pieter
(Pieter)
2
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;
Pieter
(Pieter)
6
We have investigated this here but this seems to be an FireMonkey/Android specific issue. Loading a PNG does not throw an error.