Subject Problems ordering Column in IB_Grid and on event onGetCellProps
Author Luiz Alves
List,

Another problem with this simple query test:

I have a simple query as ' Select Pront, Nome,...(other fields) from
Clientes' with FB 1.0 Beta 2 Dialect 3

Ordering Items:
prontuario=PRONT;PRONT desc;
paciente=NOME;NOME desc;

Ordering Links
PRONT=ITEM=1;POS=0
NOME=ITEM=2;POS=0

OrderingItemNo=1


I have asc and desc indexes on 'PRONT' and 'NOME' fields

I have noted the ordering of the rows shows wrong if I switch the order from
'PRONT' column to 'asc' and 'desc' quickly.

IBO shows the 'PRONT' column in rows as:

2000
2001
2002
2
3
4
...
...

Another problem is the code on event GetCellProps, as the next, based on IBO
Samples, stops to work( The rows are not painted correctly):

procedure TfrmClientes.IB_Grid1GetCellProps(Sender: TObject; ACol,
ARow: Integer; AState: TGridDrawState; var AColor: TColor; AFont: TFont);
var dat:Boolean;
begin
with (sender as TIB_Grid) do begin
if not (sender as TIB_Grid).Datasource.Dataset.Active then exit;
end;
if (ACol>(sender as TIB_Grid).FixedDataCols) and (ARow<>0) then
begin
with (Sender as TIB_Grid).Datasource.DataSet do begin
BufferRowNum := (Sender as TIB_Grid).DataRow[ ARow ];
if AColor <> clHighlightText then
if (BufferRowNum > 0) then begin
if (abs(ARow) mod 2)=0 then
AColor:=dm_new.DM.MyConfig.corGI
else
AColor:=dm_new.DM.MyConfig.corGF;
if (BufferFieldByName('LIBCONS').asString<>'') then
if (trunc(BufferFieldByName('LIBCONS').asDateTime)>SysUtils.Date)
then
AColor:=dm_new.DM.MyConfig.corcnl;
end;
end;
end;
with (Sender as TIB_Grid).Datasource.DataSet do begin
if Active then begin
BufferRowNum := (Sender as TIB_Grid).DataRow[ ARow ];
if AFont.Color <> clHighlightText then
if (BufferRowNum > 0) then begin
dat := BufferFieldByName('Ativo').AsBoolean;
if not dat then
AFont.Style := [fsItalic,fsStrikeOut];
if trunc(BufferFieldByName('LIBCONS').asDateTime)>SysUtils.Date then
begin
AFont.Style := AFont.Style+[fsUnderline];
end;
end;
end;
end;
end;

(IBO 4(latest) win 2000 and D6)

Regards,

Luiz.