Subject | Unfocused Grid Problem - 1:1 Cell always clBlue |
---|---|
Author | ehandbury |
Post date | 2002-04-23T01:25:18Z |
Hello,
(IBO4.2Gc, BCB4, FB-1.0-796)
I have a niggly problem with cell colours. Using the OnGetCellProps
event below produces my desired result except for the Row::1 Cell::1
Cell always starts as the background colour clBlue. Once I focus the
grid, the clBlue goes away forever.
This only happens when the Grid starts out unfocused. If I call
grAlert->setFocus() in the OnShow event then the 1::1 cell is a
normal colour.
How can I ensure that the 1::1 cell is my usual background
regardless if the grid is focused or not?
TIA. Eric.
void __fastcall TAlertForm::grAlertGetCellProps(TObject *Sender, int
ACol,
int ARow, TGridDrawState AState, TColor &AColor, TFont *AFont)
{
if (qrAlert->Active == false) return;
if (ARow == 0 || (ACol != 0 && ACol != 3)) return;
BufferRowNum = grAlert->DataRow[ ARow ];
dsAlert->Dataset->BufferRowNum = BufferRowNum;
i = qrAlert->BufferFieldByName("PRIORITY")->AsSmallint;
switch(i) {
case 2:
case 3:
AColor = clLime; break;
case 4:
AColor = clYellow; break;
case 5:
case 6:
AColor = clRed; break;
}
}
(IBO4.2Gc, BCB4, FB-1.0-796)
I have a niggly problem with cell colours. Using the OnGetCellProps
event below produces my desired result except for the Row::1 Cell::1
Cell always starts as the background colour clBlue. Once I focus the
grid, the clBlue goes away forever.
This only happens when the Grid starts out unfocused. If I call
grAlert->setFocus() in the OnShow event then the 1::1 cell is a
normal colour.
How can I ensure that the 1::1 cell is my usual background
regardless if the grid is focused or not?
TIA. Eric.
void __fastcall TAlertForm::grAlertGetCellProps(TObject *Sender, int
ACol,
int ARow, TGridDrawState AState, TColor &AColor, TFont *AFont)
{
if (qrAlert->Active == false) return;
if (ARow == 0 || (ACol != 0 && ACol != 3)) return;
BufferRowNum = grAlert->DataRow[ ARow ];
dsAlert->Dataset->BufferRowNum = BufferRowNum;
i = qrAlert->BufferFieldByName("PRIORITY")->AsSmallint;
switch(i) {
case 2:
case 3:
AColor = clLime; break;
case 4:
AColor = clYellow; break;
case 5:
case 6:
AColor = clRed; break;
}
}