For my Tile List I have 2 styles of tile (let's say red and blue). As the tiles are created they are assigned a style and first time through it works well.
When a Tile is clicked a new set of tiles is loaded. The problem is it seems that the tiles remember what they originally were in that position. I have tried TileList.ClearAllTiles(nil) and TileList.Tiles.Clear, but neither seems to make a difference.
Any suggestions?
Thanks
Did you use a BeginUpdate / EndUpdate ?
Kind Regards,
Pieter
yes, I did. The actual code is:
TMSFMXTileList1.BeginUpdate;
try
TMSFMXTileList1.Tiles.Clear;
while not MainDM.Typology.Eof do
begin
tl := TMSFMXTileList1.Tiles.Add;
tl.Caption := MainDM.TypologyCLASSID.Value;
tl.Notes := MainDM.TypologyCAPTION.Value;
tl.DataString := MainDM.TypologyTILETYPE.Value + ';' + MainDM.TypologyCLASSID.Value;
if MainDM.TypologyTILETYPE.Value = '1' then
begin
tl.StyleLookup := 'TypologyTile';
end
else
begin
tl.StyleLookup := 'ObjectTile';
if not MainDM.TypologyIMAGE.IsNull then
begin
str := TMemoryStream.Create;
try
MainDM.TypologyIMAGE.SaveToStream(str);
tl.Bitmap.LoadFromStream(str);
finally
str.Free;
end;
end;
end;
MainDM.Typology.Next;
end;
finally
TMSFMXTileList1.EndUpdate;
end;
I cannot see anything wrong here,
Can you force an TMSFMXTileList1.NeedStyleLookUp and TMSFMXTileList1.ApplyStyleLookUp after TMSFMXTileList1.EndUpdate?
Also try to put the TMSFMXTileList1.Tiles.Clear before the BeginUpdate?
Kind Regards,
Pieter
that seems to have worked.
thanks