We have just upgraded from Delphi 2010 to XE4 and using FireMonkey for the first time, so stumbling about in the dark a bit trying to figure out how it all works.
As per a query a while back I'm trying to get individual cells in a TGrid component to display differently based on some rule. I have worked through the helpful code posted by Mike Sutton:
Firemonkey Grid Control - Styling a Cell based on a value (via the OnGetValue function call)
I had to make a few changes to get it to compile in XE4; it all looks ok when running the code, except that:
The relevant code (the rest is pretty much as per the link above):
Procedure TFinancialCell.ApplyStyle;
var
T: TFMXObject;
begin
inherited;
ApplyStyling;
end;
Procedure TFinancialCell.ApplyStyling;
begin
// If IsNegative then
// FontFill.Color:=claRed
// else
// FontFill.Color:=claBlack;
Font.Style:=[TFontStyle.fsItalic];
If IsImportant then
Font.Style:=[TFontStyle.fsBold]
else
Font.Style:=[];
If Assigned(Font.OnChanged) then
Font.OnChanged(Font);
Repaint;
end;
The IsImportant flags are being set correctly so that doesn't seem to be the problem.
Any help with this would really be appreciated. Apologies in advance for anything stupid I might be missing.
That article has largely been superseded by some stuff in my FireMonkey Guide site, http://monkeystyler.com/guide/Category:Grids
From XE3 onwards if you want to modify stuff you need to remove the appropriate item from the StyledSettings property,
StyledSettings := StyledSettings - [TStyledSetting.ssStyle, TStyledSetting.ssFontColor]
etc.
To change the font color use the FontColor property