Subject | Problems with TIB_Grid colours - Was: Problems updating a cursor |
---|---|
Author | Salvatore Besso |
Post date | 2004-05-24T07:52:07Z |
hello,
I have made the SP and now it correctly goes into edit state and i can
modify the three fields, very well :-)
The next problem is about different TIB_Grid colours. I have followed
the code used in one of the samples that come with IBO to try to
colour in red the whole row where the field REJECTED equals 1:
procedure TMainForm.GridGetCellProps(Sender: TObject; ACol, ARow:
Integer;
AState: TGridDrawState; var AColor: TColor; AFont: TFont);
var
Grd: TIB_Grid;
TmpFld: TIB_Column;
begin
Grd := (Sender as TIB_Grid);
if (Assigned(Grd.DataSource)) and (Grd.DataSource.Prepared)
and (Grd.DataSource.Dataset.RowNum = Grd.DataRow[ARow])
and not (gdFixed in AState)
and (Grd.DataSource.State = dssBrowse) then
begin
TmpFld := Grd.GridFields[Grd.DataCol[ACol]];
if Assigned(TmpFld) and (TmpFld.FieldName = 'REJECTED')
and (TmpFld.AsInteger = 1) then
begin
Grd.CurrentRowColor := clRed;
Grd.CurrentRowFont.Color := clWhite
end
end
end;
The problem is that the row is coloured in red only when it is the
current row in the grid, but I'd like that the row remain red coloured
also when it is not the current row in the grid, that's to say when I
scroll to another row. How is this possible?
Regards
Salvatore
I have made the SP and now it correctly goes into edit state and i can
modify the three fields, very well :-)
The next problem is about different TIB_Grid colours. I have followed
the code used in one of the samples that come with IBO to try to
colour in red the whole row where the field REJECTED equals 1:
procedure TMainForm.GridGetCellProps(Sender: TObject; ACol, ARow:
Integer;
AState: TGridDrawState; var AColor: TColor; AFont: TFont);
var
Grd: TIB_Grid;
TmpFld: TIB_Column;
begin
Grd := (Sender as TIB_Grid);
if (Assigned(Grd.DataSource)) and (Grd.DataSource.Prepared)
and (Grd.DataSource.Dataset.RowNum = Grd.DataRow[ARow])
and not (gdFixed in AState)
and (Grd.DataSource.State = dssBrowse) then
begin
TmpFld := Grd.GridFields[Grd.DataCol[ACol]];
if Assigned(TmpFld) and (TmpFld.FieldName = 'REJECTED')
and (TmpFld.AsInteger = 1) then
begin
Grd.CurrentRowColor := clRed;
Grd.CurrentRowFont.Color := clWhite
end
end
end;
The problem is that the row is coloured in red only when it is the
current row in the grid, but I'd like that the row remain red coloured
also when it is not the current row in the grid, that's to say when I
scroll to another row. How is this possible?
Regards
Salvatore