Jump to content


Photo

Easiest way to change font style

OnCellFormating equivalent

  • Please log in to reply
4 replies to this topic

#1 AlexMex

AlexMex
  • Members
  • 16 posts

Posted 06 May 2022 - 02:27 PM

Hello Boki,

 

I have an application with a grid displaying a small inventory. If inventory is low I am changing with GetCellColor event the background of the cell. Customer asks me to change the font color / style (red/bold) instead of changing background. I can't find in doc, demo or even my own code how I was doing it in the past. OnCellFormating does not exist any more in v6.

 

Regards,

AlexMex



#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,070 posts
  • Gender:Male

Posted 06 May 2022 - 03:39 PM

Hi,

 

For this purpose you can use OnStyleText event that now exists for every column:

procedure TForm1.NxTextColumn61StyleText(Sender: TObject; ACol, ARow: Integer; var FontColor: TColor; FillColor: TColor;
  var FontStyle: TFontStyles; CellValue: INxBase; CellState: TNxCellPaintingState);
begin
  // You can inspect all what you need and set FontStyle or FontColor
end;

boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#3 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,070 posts
  • Gender:Male

Posted 06 May 2022 - 03:40 PM

I hope that this helps :)


boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#4 AlexMex

AlexMex
  • Members
  • 16 posts

Posted 20 May 2022 - 12:06 PM

Hi Boki,

 

Yes it helps :D. But (there is a nice line in GOT about but  :P ) it does not work for TNxDateColumn6. So I have all the line except two columns in Red. Any suggestion?

 

Best Regards,

AlexMex



#5 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,070 posts
  • Gender:Male

Posted 20 May 2022 - 12:09 PM

Hm, I will check it now. Hopefully is some small tweak.


boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users