0

Have almost got Mike's solution with the manipulation of tgrid to work. The only thing I'd like to know is how to set the background in ApplyStyling procedure?

Procedure TFinanicalCell.ApplyStyling;
begin
  FontColor:= claBlue;
  Font.Size:= 18;
  // Background ?
    if Assigned(Font.OnChanged) then
      Font.OnChange(Font);
      Repaint;
end;

I also wonder why the value is 0 in my setData procedure?

Procedure TFinancialCell.SetData(const Value: TValue);
var
 F: Single;
begin

  F := Value.Astype<single>;
  inherited SetData(Format('%m',[F]));

end;

My GetValue procedure:

procedure TForm5.Grid1GetValue(Sender: TObject; const Col, Row: Integer; var Value: TValue);
 begin
   if Col = 0 then
    Value := Row
   else if Col = 1 then
   begin
    Value := FloatToStr(Data[Row]);
    if Data[Row] >30 then
    begin
     Value := '#' + FloatToStr(Data[Row]);
    end;
   end;
 end;
Godfather75
  • 151
  • 8
  • Check [`this question`](http://stackoverflow.com/q/16540477/960757). It was the second item from related list on the right side of this page. – TLama Dec 23 '13 at 21:25
  • 1
    @Arioch'The it is not a real dupe because of two questions in one (Styling and Data) and the Styling part is dupe :o) – Sir Rufo Dec 24 '13 at 08:31
  • What is your OnGetData code from the form? – Mike Sutton Dec 27 '13 at 09:20
  • Mike: My getValue method is implemented in my Form. I add the method to the code above so you can see it – Godfather75 Dec 27 '13 at 09:55
  • I read the article "Changing TTextCell background color to runtime XE4" I do not quite understand what you mean by FindStyleResource('background') do I need to manually add the rectangle from the Tool Palette? When I add FindStyleResource ('background') to ApplyStyle procedure I get nil? – Godfather75 Dec 27 '13 at 11:15

0 Answers0