Library Vcl NextSuite 6 NextGrid6 Reference Classes TNxTextColumn6 OnStyleText

OnStyleText

Occurs when text in column is about to be styled (Font is set).

pas
property OnStyleText: TNxStyleTextEvent read FOnStyleTextEvent write FOnStyleTextEvent;

After reading Cell's value or state FontColor or FontStyle var parameters can be set.

Remarks

This event is similar to OnCellFormating event from NextGrid version 5.

Example

pas
procedure TForm6.NxNumberColumn61StyleText(Sender: TObject;
  ACol, ARow: Integer; var FontColor: TColor;
  FillColor: TColor; var FontStyle: TFontStyles;
  CellValue: INxBase; CellState: TNxCellPaintingState);
begin
  { Here we examine CellValue and decide on style }
  if CellValue.AsFloat < 50 then FontColor := clRed
  else if CellValue.AsFloat < 100 then FontColor := clMaroon
  else if CellValue.AsFloat >= 200 then
  begin
    FontColor := clBlue;
    FontStyle := [fsItalic];
  end else
  begin
    { Use default }
  end;
end;

NxIntf6, NxTypes6 units need to be added into uses section of the unit.

Files

Sign in