What would be the most efficient way to display icons in front of some strings in the TMSFMXGrid component? I see several options like adding HTML or OnGetCellLayout.
I tried using
<div title="Page 38">
<div>
<div>
<p><span style="font-size: 11.000000pt; font-family: 'Arial'">Grid->AddBitmap(Col,Row: Integer; AName: string);<br>
But it takes about 10 seconds to put a bitmap in every row in the grid. I was hoping for a OnGetCellData type of event where I can check the row and see if and what icon is needed when a cell needs to be drawn.
Hi, You can add an image in HTML by returning the correct string in the OnGetCellData or by setting the string directly on the Cells property.
procedure TForm1143.TMSFMXGrid1GetCellData(Sender: TObject; ACol, ARow: Integer;
var CellString: string);
begin
CellString := '<img src="name of icon in bitmap container"/> Hello World !';
end;
TMSFMXGrid1.Cells[3, 4] := '<img src="name of icon in bitmap container"/> Hello World !';
And assign a TTMSFMXBitmapContainer to the grid which has the correct names for the icons.
Kind Regards,
Pieter
Pieter Scheldeman2014-01-24 02:51:21
This actually works really fast. Sorry for not trying before posting. I was expecting the extra parsing of HTML to slow things down. Thank you again Pieter.
Kind regards,
Ilan Shemes