Jump to content


Photo

Get Cell Color


  • Please log in to reply
5 replies to this topic

#1 eikcam

eikcam
  • Members
  • 23 posts
  • Gender:Male
  • Location:Sydney, Australia

Posted 23 April 2013 - 02:28 PM

Is there a way to get the current color of a cell?

In the CellColoring event I have the following and it does not seem to work;


CellColor := gridHours.Cell[ACol, ARow].ActualColor;

Is where a way to get the color? I have tried a test using the OnCellClick event and displaying the cell color in a msgbox however it does not return the clicked cell color.

Regards,

Dan.

#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 25 April 2013 - 06:04 PM

Hello,

You may read CellColor var parameter inside this event (it is already set)
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 eikcam

eikcam
  • Members
  • 23 posts
  • Gender:Male
  • Location:Sydney, Australia

Posted 27 April 2013 - 10:04 AM

Hello,

You may read CellColor var parameter inside this event (it is already set)


What I am trying to do is populate a grid from another grid. I currently read the first 10 rows of one grid however I am not able to read the CellColor from the grid I want to copy.

#4 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 03 May 2013 - 09:38 PM

Hello,

Please sorry for delay.

I think that you may simply call this event, or maybe set Color property of Cell?
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.

#5 eikcam

eikcam
  • Members
  • 23 posts
  • Gender:Male
  • Location:Sydney, Australia

Posted 04 May 2013 - 08:55 AM

Hi,

Thanks for replying Boki.


In the OnCellColoring event, setting the CellColor variable does change Cell[x, x].Color.

Below is the code I have to use to allow me to get the cells color at a later stage.

        CellColor := StringToColor(AppSettings.ColourHours.ValueFromIndex[i]);
        TNextGrid(Sender).Cell[ACol, ARow].Color := CellColor;

The problem with this is that it causes a continuous refresh to occur.

Regards,

Dan.

#6 ErlingSj

ErlingSj
  • Members
  • 1 posts

Posted 21 July 2013 - 05:48 PM

CellColor := StringToColor(AppSettings.ColourHours.ValueFromIndex[i]);
--
Try adding:
if TNextGrid(Sender).Cell[ACol, ARow].Color <> CellColor
then TNextGrid(Sender).Cell[ACol, ARow].Color := CellColor;




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users