Subject | Another Grid behaviour |
---|---|
Author | Riho-Rene Ellermaa |
Post date | 2002-01-11T13:57:06Z |
I use following snippet to color the rows in grid according to row
status. It worked OK in IBO 3.
In IBO4 also the column titles get colored. For example when I have
black text in top rows and blue below, then when scrolling down the
title rows changes to blue
void __fastcall TFMaster::GridGetCellProps(TObject *Sender, int ACol,
int ARow, TGridDrawState AState, TColor &AColor, TFont *AFont)
{
if(DSource && DSource->Dataset && DSource->Dataset->Active)
{ int BufferRowNum = Grid->DataRow[ ARow ];
DSource->Dataset->BufferRowNum = BufferRowNum;
int stat =
DSource->Dataset->BufferFieldByName("STATUS")->AsInteger;
if(stat==1)
AFont->Color =
Common.IniFile->ReadInteger("Colors","Prepared",clBlack);
else if(stat==3)
AFont->Color =
Common.IniFile->ReadInteger("Colors","Waiting2",clOlive);
else if(stat==2)
AFont->Color =
Common.IniFile->ReadInteger("Colors","Accepted",clGreen);
else if(stat==4)
AFont->Color =
Common.IniFile->ReadInteger("Colors","Rejected",clRed);
else if(stat==8)
AFont->Color =
Common.IniFile->ReadInteger("Colors","Sent",clBlue);
else if(stat==16)
AFont->Color =
Common.IniFile->ReadInteger("Colors","Archived",clTeal);
else
AFont->Color = clWindowText;
}
}
Riho-Rene Ellermaa
senior programmer
Hansabank
status. It worked OK in IBO 3.
In IBO4 also the column titles get colored. For example when I have
black text in top rows and blue below, then when scrolling down the
title rows changes to blue
void __fastcall TFMaster::GridGetCellProps(TObject *Sender, int ACol,
int ARow, TGridDrawState AState, TColor &AColor, TFont *AFont)
{
if(DSource && DSource->Dataset && DSource->Dataset->Active)
{ int BufferRowNum = Grid->DataRow[ ARow ];
DSource->Dataset->BufferRowNum = BufferRowNum;
int stat =
DSource->Dataset->BufferFieldByName("STATUS")->AsInteger;
if(stat==1)
AFont->Color =
Common.IniFile->ReadInteger("Colors","Prepared",clBlack);
else if(stat==3)
AFont->Color =
Common.IniFile->ReadInteger("Colors","Waiting2",clOlive);
else if(stat==2)
AFont->Color =
Common.IniFile->ReadInteger("Colors","Accepted",clGreen);
else if(stat==4)
AFont->Color =
Common.IniFile->ReadInteger("Colors","Rejected",clRed);
else if(stat==8)
AFont->Color =
Common.IniFile->ReadInteger("Colors","Sent",clBlue);
else if(stat==16)
AFont->Color =
Common.IniFile->ReadInteger("Colors","Archived",clTeal);
else
AFont->Color = clWindowText;
}
}
Riho-Rene Ellermaa
senior programmer
Hansabank