Subject Re: [IBO] tib_grid title color for sorted column
Author stanw1950
Geoff, I tried but still the wrong title rectangle changes color. I
tried to match the field names by using

if ((ARow < ib_grid.FixedRows)
and (ACol >= ib_grid.FixedCols)
and (ib_query.OrderingItemNo <> 0)
and (ib_query.Fields[ib_grid.DataCol[ACol]].FieldName
= ib_query.OrderingField.FieldName)) then
AColor := clLime;

but this got the same wrong result. Any more ideas? Thanks.



--- In IBObjects@y..., Geoff Worboys (TeamIBO) <geoff@t...> wrote:
> > Geoff, thanks. The code sort of works but I have 12 columns
> > displaying in the grid and only 7 of them are sortable. When I
click
> > on a sortable column title, a different column title color turns
> > green (and sometimes none turn green). In other words, the wrong
> > title turns green or no title turns green. What are your
assumptions
> > for the code? Thanks.
>
> Hi Stan,
>
> After I posted I wondered if I made a mistake...
>
> >> (IB_Grid.DataCol[ACol] = IB_Query.OrderingField.FieldNo) then
> ^^^^^^^
>
> Try using IB_Query.OrderingField.Index instead. (FieldNo has to do
> with the actual SQL order of the fields, so when CalculatedFields
> exist it does not match the Index in the internal TList.)
>
> Sorry about that.
>
> --
> Geoff Worboys - TeamIBO
> Telesis Computing