Jump to content


Photo

SelectionTextColor for Cell


  • Please log in to reply
7 replies to this topic

#1 DelphiToday

DelphiToday
  • Members
  • 146 posts
  • Gender:Male

Posted 14 May 2020 - 09:27 PM

 Hi Bojan,

I can't adjust the selection color for each line. As an example I use 'SelectionTextColor := clGreen' if Played is True but that gives wrong colors.

Is it possible to add:
Cell.SelectionTextColor ?
Or something I can use?

procedure TForm3.NxVirtualCellSource61GetCell(Sender: TObject; ACol,
  ARow: Integer; Cell: INxCell);
begin
  case ACol of
    0: Cell.AsString := GlobalRec.CurrentFile;
  end;

  { Default }
  Cell.Font.Color := clBlue;
  NextGrid.SelectionTextColor := clBlue;

  { Change }
  if (GlobalRec.Played) then
  begin
    NextGrid.SelectionTextColor := clGreen; // Color Problems
    Cell.Font.Color := clGreen;
  end;
end;

Kind regards,

Eduard.

 



#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 15 May 2020 - 12:15 AM

Hello,

 

Not sure if this is the best way to do it. I will rather use following event:

http://developer.ber...=182&lang=en-us
 

There is a state parameter which you can read and set desired color dynamically.

 

hope it helps

 


boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.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 DelphiToday

DelphiToday
  • Members
  • 146 posts
  • Gender:Male

Posted 15 May 2020 - 05:55 AM

Hello,

 

This is CellColor not TextColor. This doesn't help.

 

The above colors must be FontText clGreen not background.

 

And now?

Attached Files



#4 DelphiToday

DelphiToday
  • Members
  • 146 posts
  • Gender:Male

Posted 15 May 2020 - 05:25 PM

Maybe improve Event or add new one?



#5 DelphiToday

DelphiToday
  • Members
  • 146 posts
  • Gender:Male

Posted 16 May 2020 - 02:37 PM

Found it. I guess I wasn't clear enough. :o
This should be good?

procedure TForm1.NxTextColumn61StyleText(Sender: TObject; ACol, ARow: Integer;
  var FontColor: TColor; FillColor: TColor; var FontStyle: TFontStyles;
  CellValue: INxBase; CellState: TNxCellPaintingState);
begin
  if (GlobalRec.Played) then FontColor := clGreen;
end;

Now set per column and we can continue :)
 

The point was that each column would have a different text color depending on its status.
The problem was 'SelectionTextColor' because it works globally.

 

:wacko:



#6 DelphiToday

DelphiToday
  • Members
  • 146 posts
  • Gender:Male

Posted 16 May 2020 - 02:38 PM

Found it. I guess I wasn't clear enough. :o
This should be good?

procedure TForm1.NxTextColumn61StyleText(Sender: TObject; ACol, ARow: Integer;
  var FontColor: TColor; FillColor: TColor; var FontStyle: TFontStyles;
  CellValue: INxBase; CellState: TNxCellPaintingState);
begin
  if (GlobalRec.Played) then FontColor := clGreen;
end;

Now set for each column and we can continue :)
 

The point was that each column would have a different text color depending on its status.
The problem was 'SelectionTextColor' because it works globally.

 

:wacko:

 



#7 DelphiToday

DelphiToday
  • Members
  • 146 posts
  • Gender:Male

Posted 16 May 2020 - 02:40 PM

:rolleyes: something went wrong Editing :blink:



#8 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 17 May 2020 - 11:50 AM

Yes, you can use this event. Just attach other columns to the same event.


boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users