Subject RE: [IBO] Column ordering
Author Paul Vinkenoog
Hello Riho-Rene,

> It appears, that suddenly one property - position of the grid
> columns - is stored into TIB_Grid properties, namely GridLinks. And
> this overwrites the TIB_Query's FieldsIndex.

I don't know if it really *overwrites* it: this would mean that if you
change an TIB_Grid's GridLinks, the TIB_Query's FieldsIndex would
change accordingly.

But I do know that GridLinks *override* the ordering you have
specified in the TIB_Query. If GridLinks is empty, the order from the
TIB_Query applies. Lots of properties in IBO work like this.

> At the same time the grid column width is still determined in the
> TIB_Query?!? The logic of this escapes me.

This is again a default width. You can override it at the TIB_grid
level using ColWidths (inherited from TCustomGrid).

> If I set the columns ordering, and user reorders them, I can get the
> the order at the closing my form. That's fine. BUT, if I dont set
> the orders specifically (I use the defualt values), then I can't get
> the new orders at the end. I can reorder them as much I like, but
> when closing the form , the GridLinks property is empty.

You can get the actual grid column order using the TIB_Grid's
GridFields prop. Iterate the GridFields from 0 thru GridFieldCount-1
and you get the TIB_Column references. From there you can get
FieldName, DisplayLabel, FieldNo (0-based field number in the query,
not necessarily in the grid), etc. etc.

This always works, you don't have to set GridFields manually.


Greetings,
Paul Vinkenoog