Jump to content


Photo

OnSlideColoring


  • Please log in to reply
8 replies to this topic

#1 coasting

coasting
  • Members
  • 29 posts
  • Gender:Male
  • Location:Germany

Posted 01 May 2010 - 03:02 PM

Hi all,

I am trying to assign a color depending on the cell value of a dataset. The following code works well for row coloring when DBGrid is in gsReport mode (OnCellColoring) but does not work when gsSlide (OnSlideColoring) is set:

CODE
  
  if DataSource1.DataSet.FieldByName('mDays').AsInteger <= -1 then
    SlideColor := clRed;

  if DataSource1.DataSet.FieldByName('mDays').AsInteger = 0 then
    SlideColor := clInfobk;

  if DataSource1.DataSet.FieldByName('mDays').AsInteger >= 1 then
    SlideColor := clGreen;


Any hint on that?

Many thanks

coasting

#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 01 May 2010 - 09:23 PM

Hello Coasting,

I will inspect this. Thank you,

Best regards
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 coasting

coasting
  • Members
  • 29 posts
  • Gender:Male
  • Location:Germany

Posted 01 May 2010 - 09:42 PM

Hi

thx. My intention is to paint each slide background in a different color. Maybe the way I am trying to do it is wrong. Thx yr help.

coasting

#4 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 02 May 2010 - 01:33 AM

Hi,

i have check it once again and seems to be working fine. Maybe small demo project can help?

Best regards
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 coasting

coasting
  • Members
  • 29 posts
  • Gender:Male
  • Location:Germany

Posted 02 May 2010 - 01:17 PM

Hi

ok, I took ADO Demo3 as a base, switched DBGridView2 to gsSlides and put in the following code:

CODE
procedure TForm1.DBGridView2SlideColoring(Sender: TObject; Index: Integer;
  var SlideColor, GridColor: TColor; SlideState: TSlideState);
begin

  if DataSource2.DataSet.FieldByName('OrderId').AsInteger <= 19 then
    SlideColor := clRed;

  if DataSource2.DataSet.FieldByName('OrderId').AsInteger = 20 then
    SlideColor := clYellow;

  if DataSource2.DataSet.FieldByName('OrderId').AsInteger >= 21 then
    SlideColor := clGreen;

end;


Result is that all slides are painted clRed. When clicking through the slides color of all slides is changing. What am I doing wrong?

coasting



#6 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 04 May 2010 - 02:01 AM

Hi,

Try to add at the top of code a SlideColor = NextDBGrid1.Color;

maybe this will helps.

Best regards
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.

#7 coasting

coasting
  • Members
  • 29 posts
  • Gender:Male
  • Location:Germany

Posted 04 May 2010 - 09:16 PM

Hi Boki,

nope, doesn't help :/ Did you try yourself? Still all slides are Red. When clicking through the slides the focused one is painted correct but all other slides will then be painted in same color...!?, i.e. the slide with focus is defining the color of the other ones. Any other hint?

Many thx

coasting

#8 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 05 May 2010 - 01:16 AM

Hello Coasting,

It seems that it takes a only active record when painting a color.

I will need some time to fix it. Thank you for reporting this.

Please sorry for this problem.

Best regards
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.

#9 coasting

coasting
  • Members
  • 29 posts
  • Gender:Male
  • Location:Germany

Posted 06 May 2010 - 09:28 PM

Hi Boki,

take your time. Meanwhile I am using the OnCellColoring event.

coasting




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users